It looks like two maps with the same entries but different ordering are
considered different.
I'm trying to create a set of maps and I'm inserting two maps.
Both maps are identical but the order in which the items were inserted into
the map is different.
I was thinking that an associative sequence like set is using is_same to
compare two elements
and I tried to overload is_same -- but this did not work.
See code below or attached.
#include
zero_2_one; typedef pair< one, one one_2_one; for_each< insert< insert< set<>, insert< insert< map<>, zero_2_one ::type, one_2_one ::type ::type, insert< insert< map<>, one_2_one ::type, zero_2_one ::type ::type (print()); return 0; }
"Peter Foelsche"
::type type;
};
template
::type VECTOR;
typedef typename boost::mpl::sort< typename boost::mpl::push_back< VECTOR, VALUE
::type,
compare
::type SORTED;
typedef typename boost::mpl::accumulate<
SORTED,
boost::mpl::map<>,
boost::mpl::insert
::type type;
};
AMDG On 03/21/2011 07:26 AM, Peter Foelsche wrote:
"Peter Foelsche"
wrote in message news:im65n2$u72$1@dough.gmane.org... I wrote my own insert to overcome this problem. Extracting the elements, sorting them and then inserting them back.
I think this should either be fixed or documented.
boost::is_same returns true when the two arguments are exactly the same type. MPL makes absolutely no guarantees about the exact types of sequences. In Christ, Steven Watanabe
On 03/20/11 19:21, Peter Foelsche wrote:
It looks like two maps with the same entries but different ordering are considered different. I'm trying to create a set of maps and I'm inserting two maps. Both maps are identical but the order in which the items were inserted into the map is different. I was thinking that an associative sequence like set is using is_same to compare two elements and I tried to overload is_same -- but this did not work.
IIRC, mpl uses mpl::equal(or some similar name) to test equality of associative sequences.
participants (3)
-
Larry Evans
-
Peter Foelsche
-
Steven Watanabe