Joaquin M Lopez Munoz wrote:
You've got to implement semantics equivalent to that of the < relationship between numbers: Thanks for the info; I now believe I'm doing this correctly.
* Now, in the piece of your code where the insert asserts, add a precheck of the invariant:
m.check_invariant_(); // point A m.insert(...); // point B
* Run your test till the assert fires. Is it in point A or B? If A, then most likely you're somehow modifying the elements in some other thread. Get the idea? This is a great idea! I added the precheck as you suggested, and it appears that I am experiencing the assert in 'point B'. The invariant is OK until the insertion breaks it. So can I infer that somehow what I'm inserting is invalid? It's a shared_ptr. I recently sent in another post regarding problems I'm having with shared_ptrs that might be related (see post w/subject: "shared_ptr use_count in multi threaded environment").
Thanks!