Opened 12 years ago

Last modified 12 years ago

#4357 new Feature Requests

mpl::equal for associative sequences

Reported by: anonymous Owned by: Joel Falcou
Milestone: Boost 1.46.0 Component: mpl
Version: Boost 1.44.0 Severity: Problem
Keywords: Cc: joel.falcou@…

Description

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.

Change History (3)

comment:1 by Steven Watanabe, 12 years ago

Resolution: wontfix
Status: newclosed

mpl::equal is the equivalent of std::equal. Adding a special case for set would be a bad idea.

comment:2 by anonymous, 12 years ago

Resolution: wontfix
Status: closedreopened

ok, so mpl::equal was the wrong choice, but there is still no easy way to compare two sets for equality. std::set<>s have operator==. so mpl::equal_to might be the right choice.

comment:3 by Joel Falcou, 12 years ago

Cc: joel.falcou@… added
Milestone: Boost 1.43.0Boost 1.46.0
Owner: changed from Aleksey Gurtovoy to Joel Falcou
Status: reopenednew
Note: See TracTickets for help on using tickets.