Hello!
std::equal_range requires that the container be pre-sorted (
http://www.cplusplus.com/reference/algorithm/equal_range/)
How does multi-index container handle this scenario with respect to hashed
non-unique indices. The reason I ask is since I'm facing a situation with
equal_range. Please see below code -
typedef bmi<
UserIdEntry,
indexed_by<
hashed_non_unique,
composite_key
>
>
UserIdContainer;
typedef UserIdContainer::index::type IndexById1Id2;
typedef IndexById1Id2::const_iterator IndexById1Id2_it;
std::pair entries =
indexById1Id2.equal_range(make_tuple(id1_val, id2_val));
I'm seeing that *sometimes* entries.first equals indexById1Id2.end()
and entries.second
does not equal indexById1Id2.end(). The lookup is valid - meaning I've
verified that there is at-least one entry which should be caught by the
equal_range.
I'm guessing the iterators' values are swapped. (second should be pointing
to first and first should be pointing to second) What could be the reason
for this?
Thanks,
MK.