A C++ library which enables the construction of containers maintaining one or more indices with different sorting and access semantics.
Questions tagged [boost-multi-index]
248 questions
2
votes
2 answers
How to iterate through the indices of a Boost Multi_index container?
I have a boost::multi_index::multi_index_container container having six different ordered_non_unique indices. The idea is to be able to sort the data along these six indices (as a means of ranking solutions using multiple criteria).
The issue I'm…

TCSGrad
- 11,898
- 14
- 49
- 70
2
votes
1 answer
How to find all matches boost::multi_index with a key?
I have a boost::multi_index container. Could anybody tell me how to retrieve a range of iterators based on a certain key? After hours of search I got the idea that lower_bound or upper_bound should do the trick but I still do not got an example. In…

loudking
- 115
- 4
2
votes
1 answer
Boost Multi-Index Composite Key for Multiple-Column Indexes
I have some records, pattern is (id, length, width);
I want to search like "length in [10,20) and width in (20,30]";
If I use relational database, I could create a Multiple-Column Indexes on length and width.
I need to do that job in memory. I see…

user3529280
- 43
- 5
2
votes
1 answer
boost::multi_index_container with random_acces and hashed_unique
I'am trying to create container with both index and key access with unique keys: so here is my code:
#include
#include
#include
#include…

Jeka
- 1,364
- 17
- 33
2
votes
2 answers
C++: Determine the class of a pointer type in the use of Boost MultiIndex
The answer to this question has general application, but I will motivate it with the following example:
I have the following template class:
template
class Collection
{
public:
struct id{};
struct name{};
// A collection…

unshul
- 269
- 3
- 16
2
votes
2 answers
Iterating over a boost multi_index
SO. I am working with an igraph object and I want to iterate over vertices in a particular order. The order is determined by a vertex attribute called "value" and I'd like to operate highest-to-lowest. igraph can provide all of the values as an…

Brian Dolan
- 3,086
- 2
- 24
- 35
2
votes
1 answer
Boost::multi_index with map
I have a question about modifying elements in boost::multi_index container.
What I have is the structure, containing some pre-defined parameters and
a number of parameters, which are defined at run-time, and stored in a map.
Here is a simplified…

pausag
- 136
- 8
2
votes
1 answer
partial_sort on boost multi_index's random access index
I was wondering if there is a way to use std::partial_sort or boost::partial_sort on multi_index's random access index.
If I try to use std::patial_sort I get compiler errors implying that the iterator derefence is const therefore I cannot compile.…

Saif Ur Rehman
- 338
- 3
- 14
2
votes
2 answers
How to store elements in boost::multi_index::multi_index_container?
I want to use multi index container of boost. To use it I tried following sample program to understand the insertion of elements in the container.
Following is my code :
#include
#include
#include…

BSalunke
- 11,499
- 8
- 34
- 68
2
votes
2 answers
boost multi_index_container, range mutating algorithms and constness
I'm using boost multi_index_container, which is queried by equal_range and the result returned from the function using range::join and boost::any_range
The any_range Reference argument is defined as const reference to the type - must be const…

kreuzerkrieg
- 3,009
- 3
- 28
- 59
2
votes
2 answers
Shared memory size calculation c++
I am keeping two objects in shared memory, one of them is a class which is :
class GlobalObj
{
public:
unsigned int counter;
unsigned int label;
bool isExist;
Globals(void){}
~Globals(void){};
};
And the other one is a…

Vecihi
- 261
- 4
- 12
2
votes
1 answer
How do I replace an item in a multi index container without affecting the insertion order?
I have a multi index container with four indexes. One of the indexes is a random access index, used to maintain the insertion order. When a property on an element of the container is updated externally, I would like the relevant index to be updated.…

MM.
- 4,224
- 5
- 37
- 74
2
votes
3 answers
Why can't `boost::multi_index replace` be used for pointer types?
Short answer: User modify instead, details in the accepted answer and also this answer
I'm attempting to use a boost::multi_index_container holding a pointer type. It appears to me the replace function is broken, and am wondering what I am doing…

Zero
- 11,593
- 9
- 52
- 70
2
votes
1 answer
boost multi_index_container broken indexes
I have a multi_index container. Chan::Ptr is a shared_pointer to the object.
The container has two indexes with object functions.
typedef multi_index_container<
Chan::Ptr,
indexed_by<
…

sz9
- 95
- 8
2
votes
1 answer
Sql IN analog in boost::multi_index
I use boost::multi_index and retrieve data like this:
sample_set::index::type::iterator s, end;
boost::tie(s,end) = samples.get().equal_range(
boost::make_tuple( "Dress", "Red" ));
This code retrieves all red dresses. Is there…

Alexander Ponomarev
- 2,598
- 3
- 24
- 31