Modify

Opened 7 years ago

Last modified 7 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.

Attachments (0)

Change History (3)

comment:1 Changed 7 years ago by Steven Watanabe

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 Changed 7 years ago by anonymous

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 Changed 7 years ago by Joel Falcou

Cc: joel.falcou@… added
Milestone: Boost 1.43.0Boost 1.46.0
Owner: changed from Aleksey Gurtovoy to Joel Falcou
Status: reopenednew

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain Joel Falcou.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.