[Boost-bugs] [Boost C++ Libraries] #4357: mpl::equal for associative sequences

Subject: [Boost-bugs] [Boost C++ Libraries] #4357: mpl::equal for associative sequences
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-06-17 07:51:29


#4357: mpl::equal for associative sequences
------------------------------+---------------------------------------------
 Reporter: anonymous | Owner: agurtovoy
     Type: Feature Requests | Status: new
Milestone: Boost 1.43.0 | Component: mpl
  Version: Boost 1.44.0 | Severity: Problem
 Keywords: |
------------------------------+---------------------------------------------
 this is not a bug, as the current behaviour is documented correctly, but I
 think mpl::equal<> should return equality for mpl::set<>s that are equal
 but are not in the same sequence.
 something like:

 struct equal :
   mpl::and_<
     mpl::equal_to<
       mpl::size<Set1>,
       mpl::size<Set2>
>,
     mpl::fold<
       Set1,
       mpl::true_,
       mpl::and_<
         mpl::_1,
         mpl::has_key<Set2,mpl::_2>
>
>
>{};

 also I think it would be usable for equal sets to be runtime-convertible.

 template<...>
 struct set{
   template<class OtherSet>
   set(OtherSet,typename enable_if<equal<set,OtherSet> >::type *e=0){}
 };

 so you can do this:

 void f(set<e1,e2>);

 f(set<e2,e1>());

 the same might be usable for mpl::map.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/4357>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:03 UTC