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<tag<id1_id2>,
                composite_key<UserIdEntry,
                    BMI_MEMBER(UserIdEntry, std::string, id1),
                    BMI_MEMBER(UserIdEntry, std::string, id2)
                >
            >
        >
> UserIdContainer;

typedef UserIdContainer::index<id1_id2>::type IndexById1Id2;
typedef IndexById1Id2::const_iterator IndexById1Id2_it;

std::pair<
IndexById1Id2_it, IndexById1Id2_it> 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.