
On Mon, Aug 31, 2009 at 2:20 AM, Marco Guazzone
Dear all,
Consider this:
---[code]--- #include
#include #include #define BOOST_TEST_MODULE "boost::mpl::set tests" #define BOOST_TEST_DYN_LINK #define BOOST_TEST_MAIN #include
BOOST_AUTO_TEST_CASE( mpl_set ) { typedef boost::mpl::set
s; BOOST_CHECK( (boost::is_same ::value) ); // Test #1 BOOST_CHECK( (boost::is_same ::value) ); // Test #2 BOOST_CHECK( (boost::is_same ::value) ); // Test #3 } ---[/code]--- Reading the docs http://www.boost.org/doc/libs/1_40_0/libs/mpl/doc/refmanual/set.html the "front" of a set
return the first element type in s which for me is t1 So what I expect is the test to fail on tests #2 and #3 and hence to succeed on test #1 Instead the test fails on tests #1 and #2 and succeeds on test #3.
Looking inside the code I find out this is OK since a setN
is defined from TN and set{N-1} , resulting in TN be the very front element Anyway, in my opinion this is counterintuitive.
Maybe a note in the document would be helpful.
What do you think?
Thank you very much!
I do not know of set being ordered or any implementation I use (considering that runtime sets are generally hash maps), so I would not expect that to be ordered personally. I would use vector if I want something ordered.