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
1
vote
1 answer
can i use equal_range to get range of values or end of container?
i know that equal_range(k) gets me range of values:
starting with k or element greater than k or end and
finishing with element greater than k or end.
i wanna modify this behaviour to give me only range of values :
starting with k or end
finishing…

ahmed allam
- 377
- 2
- 15
1
vote
1 answer
Are boost::multi_index iterators invalidated when erasing or modifying values that are the key of a different index?
In testing it seems to work fine, but I could not find any mention of the expected behaviour in the documentation.
Essentially, if my multi_index_container has 2 ordered_non_unique indices using keys A and B respectively, if I iterate over a range…

ozma
- 349
- 1
- 3
- 10
1
vote
1 answer
Is there a way to insert into a boost::multi_index with more than one hint?
I have a multi_index with 5 indices.
Using insert with a hint improves performance noticeably compared to no hint.
The insert is in the critical path, and my code is in a situation where it could give hints for all the indices (e.g: in one case, I…

Gabriel
- 2,841
- 4
- 33
- 43
1
vote
2 answers
Filter and modify elements in boost::multi_index from an equal_range query
I have a boost::multi_index with a hashed_non_unique view. What I would like to accomplish is, given a key in that view, use
pair iterRange = myView.equal_range(key);
for (myIter iter = iterRange.first; iter != iterRange.second;…

Niko
- 257
- 1
- 8
1
vote
1 answer
Error when template parameter passed to boost multi index container
I am trying to use multi_index_container with templates. below is my code.
template < class ValueType >
class anrQueue
{
private:
typedef boost::multi_index_container<
ValueType,
indexed_by<
sequenced<>,
…

Vinod Shelke
- 11
- 1
1
vote
1 answer
How to use std::get as a global_fun of boost-multi-index container keys?
I am using boost::multi-index container for a collection of tuples, and I would like to create an index on the first element of the tuple. Here is my solution by creating an wrapper function getFirst and pass it to the template parameter of the…

motam79
- 3,542
- 5
- 34
- 60
1
vote
1 answer
How to remove multiple elements from a boost::multi_index?
I am trying to do something like this:
auto& myIndex = myMultiIndex.get<0>();
auto range = myIndex.equal_range(x);
for (auto iter = range.first; iter != range.second; ++iter) {
if (somePredicate) myIndex.erase(iter);
}
Of course this does not…

Niko
- 257
- 1
- 8
1
vote
1 answer
equal_range in boost::multi_index_container composite key with comparision operator
I'm trying to query results from a multi index container where the value type is a struct of three elements. The first value is given, but the second and third have to be greater or less than a query parameter.
After searching around, I found that a…

Shailendra kumar
- 35
- 7
1
vote
2 answers
multi_index_container doesn't work with recursive variant because of ambiguous operator=
Imagine we want to model C struct with dynamic C++ types. I.e. we have a set of fields, each field has a name and a value. The value can be a simple primitive type (let's say just int for the sake of the example) or another structure, i.e. another…

facetus
- 1,091
- 6
- 20
1
vote
1 answer
Best way to modify non-indexed field of Boost Multi-Index item: modify vs mutable
I have a situation similar to the one described in this thread: Getting around Boost Multi-Index container's constant elemets. In short, I have a boost multi index container holding a struct like this:
struct Data {
Controller controller;
…

Frederico Pantuzza
- 317
- 4
- 11
1
vote
2 answers
boost multiindex: lower_bound with value_type as argument
I'd like to use lower_bound with the value_type of a Boost MultiIndex Container. So far, I only managed to make this work by explicitly extracting the members:
#include
#include…

W.Mann
- 893
- 5
- 11
1
vote
1 answer
boost::multi_index_container, operations on std::set inside container
I've created a boost::multi_index_container (containerSet) over a container class and indexed the containerSet by std::string and std::set. Is it possible to get the container, which store a specific int inside their set? Furthermore is it…

user3608078
- 316
- 2
- 9
1
vote
2 answers
boost multi_index_container search for records that fall within intervals defined by two fields
Consider the following table:
id F1 F2
0 0 10
1 5 20
2 20 30
3 8 13
4 13 17
5 50 65
6 15 26
7 8 15
Search for records that have x, where F1 <= x && x <= F2.
For example, searching for records with x = 10 would yield…

hermit.crab
- 852
- 1
- 8
- 20
1
vote
2 answers
get the position of an element in a sequenced index of boost::multi_index_container
(without iterating through the container)
I'm experimenting with replacing multiple std containers with a single boost::multi_index_container.
the boost::multi_index_container below has two indexes
using Boxes = boost::multi_index_container<
…

compound eye
- 1,898
- 18
- 23
1
vote
1 answer
Why is this member function a duplicate?
I have some code that's worked on VS10 and works on several other platforms, but causes a strange error on VS2015. The error (in a template expansion inside Boost) is very strange because it points to a form without const and tells me that it…

JDługosz
- 5,592
- 3
- 24
- 45