Boost C++ Libraries: Ticket #4357: mpl::equal for associative sequences https://svn.boost.org/trac10/ticket/4357 <p> this is not a bug, as the current behaviour is documented correctly, but I think mpl::equal&lt;&gt; should return equality for mpl::set&lt;&gt;s that are equal but are not in the same sequence. something like: </p> <p> struct equal : </p> <blockquote> <p> mpl::and_&lt; </p> <blockquote> <p> mpl::equal_to&lt; </p> <blockquote> <p> mpl::size&lt;Set1&gt;, mpl::size&lt;Set2&gt; </p> <blockquote class="citation"> <p> , </p> </blockquote> </blockquote> <p> mpl::fold&lt; </p> <blockquote> <p> Set1, mpl::true_, mpl::and_&lt; </p> <blockquote> <p> mpl::_1, mpl::has_key&lt;Set2,mpl::_2&gt; </p> <blockquote class="citation"> <p> {}; </p> </blockquote> </blockquote> </blockquote> </blockquote> </blockquote> <p> also I think it would be usable for equal sets to be runtime-convertible. </p> <p> template&lt;...&gt; struct set{ </p> <blockquote> <p> template&lt;class <a class="missing wiki">OtherSet</a>&gt; set(<a class="missing wiki">OtherSet</a>,typename enable_if&lt;equal&lt;set,<a class="missing wiki">OtherSet</a>&gt; &gt;::type *e=0){} </p> </blockquote> <p> }; </p> <p> so you can do this: </p> <p> void f(set&lt;e1,e2&gt;); </p> <p> f(set&lt;e2,e1&gt;()); </p> <p> the same might be usable for mpl::map. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/4357 Trac 1.4.3 Steven Watanabe Thu, 17 Jun 2010 17:20:36 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/4357#comment:1 https://svn.boost.org/trac10/ticket/4357#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">wontfix</span> </li> </ul> <p> mpl::equal is the equivalent of std::equal. Adding a special case for set would be a bad idea. </p> Ticket anonymous Fri, 18 Jun 2010 12:39:45 GMT status changed; resolution deleted https://svn.boost.org/trac10/ticket/4357#comment:2 https://svn.boost.org/trac10/ticket/4357#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">closed</span> → <span class="trac-field-new">reopened</span> </li> <li><strong>resolution</strong> <span class="trac-field-deleted">wontfix</span> </li> </ul> <p> ok, so mpl::equal was the wrong choice, but there is still no easy way to compare two sets for equality. std::set&lt;&gt;s have operator==. so mpl::equal_to might be the right choice. </p> Ticket Joel Falcou Thu, 30 Dec 2010 15:04:32 GMT owner, status, milestone changed; cc set https://svn.boost.org/trac10/ticket/4357#comment:3 https://svn.boost.org/trac10/ticket/4357#comment:3 <ul> <li><strong>cc</strong> <span class="trac-author">joel.falcou@…</span> added </li> <li><strong>owner</strong> changed from <span class="trac-author">Aleksey Gurtovoy</span> to <span class="trac-author">Joel Falcou</span> </li> <li><strong>status</strong> <span class="trac-field-old">reopened</span> → <span class="trac-field-new">new</span> </li> <li><strong>milestone</strong> <span class="trac-field-old">Boost 1.43.0</span> → <span class="trac-field-new">Boost 1.46.0</span> </li> </ul> Ticket