Muruganand Karthikeyan
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.
Hashed indices' equal_range works on sequences that have no particular order (other than equivalent elements being adjacent), which is fine because it does *not* use std::equal_range internally but its own logic (much as, say, std::unordered_set::equal_range).
The reason I ask is since I'm facing a situation with equal_range. Please see below code -
[...] 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.
A range [a,b) where a==end and b!=end is invalid. As far as I can see, this means that * Your code has somehow broken the internals of the container, * or Boost.MultiIndex has a bug. Can you isolate one case where you observe the anomalous behavior into a complete test snippet I can take a look at? Thank you Joaquín M López Muñoz Telefónica