Questions tagged [boost-multi-index]

A C++ library which enables the construction of containers maintaining one or more indices with different sorting and access semantics.

248 questions
1
vote
1 answer

How to using boost::multi_index with struct in struct?

I have a vector containing information called ST_ThepInfo. My problem is when using struct ST_ThepInfo in struct Infovalue_t. struct ST_ThepInfo { int length; string ex; int weight; }; struct Infovalue_t { ST_ThepInfo s; int…
Yen Dang
  • 268
  • 2
  • 9
1
vote
3 answers

Can't compile boost::multi_index_container

What is wrong in the code below? #if !defined(NDEBUG) #define BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING #define BOOST_MULTI_INDEX_ENABLE_SAFE_MODE #endif #include #include…
Alexey Starinsky
  • 3,699
  • 3
  • 21
  • 57
1
vote
1 answer

MultiIndex containers -- offering vector and set access

I have an application where, first, an std::vector object is generated. Then, some operations need to be performed on this object viewed as an std::set where the order does not matter and repetitions don't count. At present, I explicitly…
Tryer
  • 3,580
  • 1
  • 26
  • 49
1
vote
1 answer

Reversing a graph while maintaining access to edges sorted by source or target vertex

Note: I changed the title of the question because it turns out the following text and minimal example reflect my original problem poorly. The original title was "Interchanging two similar indices in a boost multi-index container" I'm implementing…
Isaac Ren
  • 113
  • 5
1
vote
2 answers

Boost Multi-Index remove elements using list of indexes

My multiindex looks like this: using pair = std::pair; struct Hasher{ std::size_t operator()(const int& k) const{ return std::hash()(k); } }; using memberFirst = member< pair, …
Apsik
  • 53
  • 6
1
vote
3 answers

Is it possible to have boost multi_index container index one element with 2 key values?

I want to have my boost multi_index container index one element with multiple key values on the same index. Is that possible? struct Student { int Id; std::unordred_set Clubs; }; Suppose this student belongs to Technology and…
Ben
  • 33
  • 4
1
vote
2 answers

Boost.Multiindex composite_key key storage

Let's say I form a composite_key of three integer members for a boost::multi_index_container. The keys will span every combination of three integers within some range ({0, 0, 0}, {0, 0, 1}, {0, 0, 2}, etc). Internally, does boost store each of these…
Sean
  • 380
  • 1
  • 11
1
vote
3 answers

Multiple indexing with big data set of small data: space inefficient?

I am not at all an expert in database design, so I will put my need in plain words before I try to translate it in CS terms: I am trying to find the right way to iterate quickly over large subsets (say ~100Mo of double) of data, in a potentially…
Sam
  • 117
  • 11
1
vote
1 answer

Find element in boost multi_index_container

In my code I need to have a functionality to iterate over all elements and check if there some element already exists possibly as soon as possible, so my choice fell on boost multi index container where I can use vector and unordered_set interface…
bladzio
  • 414
  • 3
  • 15
1
vote
2 answers

Can I use lambda as a hashing function in boost::multi_index hash-like interface?

Is it possible to use lambda for hashing in hashed__unique interface for boost::multi_index? See this example: https://godbolt.org/z/1voof3 I also saw this: How to use lambda function as hash function in unordered_map? where the answer…
Daniel
  • 980
  • 9
  • 20
1
vote
2 answers

How to find most commonly occurring non-unique keys in Boost MultiIndex?

Boost MultiIndex Container, when defined to have hashed_non_unique keys, can group equivalent keys together and return them all against an equal_range query, as mentioned here. But I see no way of querying the largest range (or n largest ranges) in…
Subhamoy S.
  • 6,566
  • 10
  • 37
  • 53
1
vote
1 answer

Cannot compile: error: expected primary-expression before '(' token

I cannot get this compile: // main.cpp #include #include #include #include #include…
Agrim Pathak
  • 3,047
  • 4
  • 27
  • 43
1
vote
1 answer

Storing references/pointers to Boost MultiSet indexes

I'm trying to build two classes Collection and CollectionView, which is an abstraction on top of Boost.MultiIndex. The idea is somewhat simple: Give an instance of type Collection to a CollectionView, and it'll handle rendering. The Collection adds…
Emil Ahlbäck
  • 6,085
  • 8
  • 39
  • 54
1
vote
1 answer

modify() boost multi-index keys during iteration

Let's assume i have following data struct with 2 int values key_x and key_y + some additional fields. struct data_object { int key_x; int key_y; //.... }; And boost multi_index_container with composite_key, including key_x and key_y…
johnbrovi
  • 82
  • 1
  • 8
1
vote
1 answer

so many error when i add certain .cpp file

i made small program which does some functions and i tested it and it worked as i wish. Then i add its .h and .cpp files to another program to use it but when i add the .cpp file it gives me 100s of errors related to boostmultiindex which i use in…
ahmed allam
  • 377
  • 2
  • 15