Boost C++ Libraries: Ticket #3529: boost::interprocess::map can't find() elements which exist in the map https://svn.boost.org/trac10/ticket/3529 <p> I have prepared a relatively small C++ program to demonstrate the problem: I create an empty segment and a map within, put there few elements and then try to list the whole map and to find specific items. Some items are perfectly visible when iterting over the map, but can't be found via find(). </p> <p> If I put some traces into operator&lt; (), I can see that only few comparsions are made (less then expected) when searching for a "missing" key </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3529 Trac 1.4.3 morozov@… Fri, 16 Oct 2009 12:09:56 GMT attachment set https://svn.boost.org/trac10/ticket/3529 https://svn.boost.org/trac10/ticket/3529 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">testmap.cc</span> </li> </ul> <p> the test C++ program </p> Ticket morozov@… Fri, 16 Oct 2009 12:12:12 GMT attachment set https://svn.boost.org/trac10/ticket/3529 https://svn.boost.org/trac10/ticket/3529 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">execution_results</span> </li> </ul> <p> Execution results </p> Ticket Steven Watanabe Fri, 16 Oct 2009 19:59:32 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/3529#comment:1 https://svn.boost.org/trac10/ticket/3529#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">invalid</span> </li> </ul> <p> Your comparison operator is not quite right. It should be </p> <pre class="wiki">bool operator&lt;(const RouteKey&amp; _o) const { return (this-&gt;tv_sec &lt; _o.tv_sec || (this-&gt;tv_sec == _o.tv_sec &amp;&amp; (this-&gt;tv_usec &lt; _o.tv_usec || (this-&gt;tv_usec == _o.tv_usec &amp;&amp; this-&gt;pid &lt; _o.pid)) )); } </pre><p> (warning untested) </p> Ticket Steven Watanabe Fri, 16 Oct 2009 20:00:14 GMT component changed https://svn.boost.org/trac10/ticket/3529#comment:2 https://svn.boost.org/trac10/ticket/3529#comment:2 <ul> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">interprocess</span> </li> </ul> Ticket