Fix set_c iterators.

[SVN r65166]
This commit is contained in:
Steven Watanabe
2010-09-01 15:16:53 +00:00
committed by Daniel James
parent 11b9928353
commit e174e49e32
2 changed files with 24 additions and 3 deletions

View File

@@ -32,7 +32,7 @@ struct s_item
typedef s_item<T,Base> item_;
typedef void_ last_masked_;
typedef T item_type_;
typedef Base base;
typedef typename Base::item_ base;
typedef typename next< typename Base::size >::type size;
typedef typename next< typename Base::order >::type order;
@@ -55,7 +55,7 @@ struct s_mask
typedef s_mask<T,Base> item_;
typedef T last_masked_;
typedef void_ item_type_;
typedef Base base;
typedef typename Base::item_ base;
typedef typename prior< typename Base::size >::type size;
BOOST_MPL_AUX_SET_OVERLOAD( aux::yes_tag, IS_MASKED, s_mask, aux::type_wrapper<T>* );
@@ -69,7 +69,7 @@ struct s_unmask
typedef s_unmask<T,Base> item_;
typedef void_ last_masked_;
typedef T item_type_;
typedef Base base;
typedef typename Base::item_ base;
typedef typename next< typename Base::size >::type size;
BOOST_MPL_AUX_SET_OVERLOAD( aux::no_tag, IS_MASKED, s_unmask, aux::type_wrapper<T>* );

View File

@@ -14,6 +14,7 @@
#include <boost/mpl/set_c.hpp>
#include <boost/mpl/at.hpp>
#include <boost/mpl/size.hpp>
#include <boost/mpl/begin_end.hpp>
#include <boost/mpl/aux_/test.hpp>
@@ -59,6 +60,18 @@ MPL_TEST_CASE()
MPL_ASSERT(( is_same< test::at_c<s1,false>::type, void_ > ));
MPL_ASSERT(( is_same< test::at_c<s2,true>::type, void_ > ));
#endif
typedef begin<s1>::type first1;
typedef end<s1>::type last1;
MPL_ASSERT_RELATION( (distance<first1, last1>::value), ==, 1 );
typedef begin<s2>::type first2;
typedef end<s2>::type last2;
MPL_ASSERT_RELATION( (distance<first2, last2>::value), ==, 1 );
typedef begin<s3>::type first3;
typedef end<s3>::type last3;
MPL_ASSERT_RELATION( (distance<first3, last3>::value), ==, 2 );
}
#endif
@@ -82,4 +95,12 @@ MPL_TEST_CASE()
MPL_ASSERT(( is_same< test::at_c<s1,'z'>::type, void_ > ));
MPL_ASSERT(( is_same< test::at_c<s2,'k'>::type, void_ > ));
#endif
typedef begin<s1>::type first1;
typedef end<s1>::type last1;
MPL_ASSERT_RELATION( (distance<first1, last1>::value), ==, 1 );
typedef begin<s2>::type first2;
typedef end<s2>::type last2;
MPL_ASSERT_RELATION( (distance<first2, last2>::value), ==, 8 );
}