elements in iterator range [__first, __last) are not partitioned
I have written an "associative vector" following Matt Austern, http://lafstern.org/matt/col1.pdf and Scott Meyers, Effective STL, Item 24. I have debugged it by comparing its results with std::map<string, int> and all the methods give expected results. Now, when I want to use it in my program, I get the following error I do not understand and google did not help
Code:
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/stl_algo.h:2691:
error: elements in iterator range [__first, __last) are not partitioned
by the predicate __comp and value __val.
Objects involved in the operation:
iterator "__first" @ 0x0x7fff5fbfac80 {
type = N11__gnu_debug14_Safe_iteratorIN9__gnu_cxx17__normal_iteratorIPKSt4pairIN9Diffusion6Bridge17Energy_Lookup_KeyEdEN10__gnu_norm6vectorIS7_SaIS7_EEEEEN15__gnu_debug_def6vectorIS7_SC_EEEE (constant iterator);
state = dereferenceable (start-of-sequence);
references sequence with type `N15__gnu_debug_def6vectorISt4pairIN9Diffusion6Bridge17Energy_Lookup_KeyEdESaIS5_EEE' @ 0x0x7fff5fbfac80
}
iterator "__last" @ 0x0x7fff5fbfac50 {
type = N11__gnu_debug14_Safe_iteratorIN9__gnu_cxx17__normal_iteratorIPKSt4pairIN9Diffusion6Bridge17Energy_Lookup_KeyEdEN10__gnu_norm6vectorIS7_SaIS7_EEEEEN15__gnu_debug_def6vectorIS7_SC_EEEE (constant iterator);
state = past-the-end;
references sequence with type `N15__gnu_debug_def6vectorISt4pairIN9Diffusion6Bridge17Energy_Lookup_KeyEdESaIS5_EEE' @ 0x0x7fff5fbfac50
}
Program received signal: “SIGABRT”.
As you can see, I am developing on OS X and the debug version of std::vector::iterator uses checked iterators. The only thing I do is replace the std::map<X, Y> with associative_vector<X, Y>. The error is triggered by a call to std::lower_bound, but I checked the key and it seems OK. The error is shown only about the 32nd time the call is made and I see similar keys passed to lower_bound before that without problem.
Where should I look to find what is wrong?