Merge pull request #16 from brunocodutra/Tickets7975_8749

Fix to Tickets #7975 and #8749 - Branched off from develop. Please check regression tests to mak sure there are no problems caused by this fix.
This commit is contained in:
Edward Diener
2015-04-28 16:28:32 -04:00
10 changed files with 62 additions and 2 deletions

View File

@@ -23,7 +23,8 @@ namespace boost { namespace mpl {
struct empty_sequence
{
struct tag;
struct tag;
typedef empty_sequence type;
struct begin { typedef random_access_iterator_tag category; };
typedef begin end;
};

View File

@@ -40,6 +40,7 @@ struct m_item
typedef Key key_;
typedef pair<Key,T> item;
typedef Base base;
typedef m_item type;
typedef typename next< typename Base::size >::type size;
typedef typename next< typename Base::order >::type order;
@@ -62,6 +63,7 @@ struct m_mask
{
typedef void_ key_;
typedef Base base;
typedef m_mask type;
typedef typename prior< typename Base::size >::type size;
typedef typename x_order_impl<Base,Key>::type key_order_;
@@ -123,6 +125,7 @@ struct m_mask
{
typedef void_ key_;
typedef Base base;
typedef m_mask type;
typedef typename prior< typename Base::size >::type size;
typedef typename x_order_impl<Base,Key>::type key_order_;

View File

@@ -33,6 +33,7 @@ struct s_item
typedef void_ last_masked_;
typedef T item_type_;
typedef typename Base::item_ base;
typedef s_item type;
typedef typename next< typename Base::size >::type size;
typedef typename next< typename Base::order >::type order;
@@ -57,6 +58,7 @@ struct s_mask
typedef void_ item_type_;
typedef typename Base::item_ base;
typedef typename prior< typename Base::size >::type size;
typedef s_mask type;
BOOST_MPL_AUX_SET_OVERLOAD( aux::yes_tag, IS_MASKED, s_mask, aux::type_wrapper<T>* );
};

View File

@@ -17,6 +17,7 @@
#include <boost/mpl/distance.hpp>
#include <boost/mpl/advance.hpp>
#include <boost/mpl/begin_end.hpp>
#include <boost/mpl/equal.hpp>
#include <boost/mpl/aux_/test.hpp>
#include <boost/type_traits/is_same.hpp>
@@ -33,4 +34,6 @@ MPL_TEST_CASE()
typedef advance_c<begin,0>::type advanced;
MPL_ASSERT(( is_same<advanced,end> ));
MPL_ASSERT(( equal< empty_sequence, empty_sequence::type > ));
}

View File

@@ -18,6 +18,7 @@
#include <boost/mpl/list.hpp>
#include <boost/mpl/sizeof.hpp>
#include <boost/mpl/deref.hpp>
#include <boost/mpl/equal.hpp>
#include <boost/mpl/aux_/test.hpp>
#include <boost/type_traits/is_float.hpp>
@@ -26,6 +27,10 @@
MPL_TEST_CASE()
{
typedef mpl::list<int,float,long,float,char[50],long double,char> types;
typedef mpl::list<float,float,long double> floats;
MPL_ASSERT(( equal< mpl::filter_view< types,boost::is_float<_> >::type,floats > ));
typedef mpl::max_element<
mpl::transform_view<
mpl::filter_view< types,boost::is_float<_> >

View File

@@ -30,6 +30,7 @@ MPL_TEST_CASE()
typedef range_c<int,0,15> answer;
MPL_ASSERT(( equal<numbers,answer> ));
MPL_ASSERT(( equal<numbers::type,answer> ));
MPL_ASSERT_RELATION( size<numbers>::value, ==, 15 );
}

View File

@@ -217,3 +217,19 @@ MPL_TEST_CASE()
>
));
}
MPL_TEST_CASE()
{
typedef insert< map<>, pair<int,int> >::type little_map;
MPL_ASSERT_RELATION(size<little_map>::value, ==, 1);
MPL_ASSERT_RELATION(size<little_map::type>::value, ==, 1);
}
MPL_TEST_CASE()
{
typedef erase_key< map< pair<float,float>, pair<int,int> >, float >::type little_map;
MPL_ASSERT_RELATION(size<little_map>::value, ==, 1);
MPL_ASSERT_RELATION(size<little_map::type>::value, ==, 1);
}

View File

@@ -329,3 +329,19 @@ MPL_TEST_CASE()
find_test<s>();
find_test<s::type>();
}
MPL_TEST_CASE()
{
typedef insert< set<>, int >::type little_set;
MPL_ASSERT_RELATION(size<little_set>::value, ==, 1);
MPL_ASSERT_RELATION(size<little_set::type>::value, ==, 1);
}
MPL_TEST_CASE()
{
typedef erase_key< set< float, int >, float >::type little_set;
MPL_ASSERT_RELATION(size<little_set>::value, ==, 1);
MPL_ASSERT_RELATION(size<little_set::type>::value, ==, 1);
}

View File

@@ -15,6 +15,7 @@
#include <boost/mpl/advance.hpp>
#include <boost/mpl/size.hpp>
#include <boost/mpl/begin_end.hpp>
#include <boost/mpl/equal.hpp>
#include <boost/mpl/aux_/test.hpp>
MPL_TEST_CASE()
@@ -37,4 +38,6 @@ MPL_TEST_CASE()
MPL_ASSERT_RELATION( (mpl::distance<last,last>::value), ==, 0 );
MPL_ASSERT_RELATION( size<view>::value, ==, 1 );
MPL_ASSERT(( equal< view, view::type > ));
}

View File

@@ -16,12 +16,22 @@
#include <boost/mpl/max_element.hpp>
#include <boost/mpl/list.hpp>
#include <boost/mpl/sizeof.hpp>
#include <boost/mpl/equal.hpp>
#include <boost/mpl/aux_/test.hpp>
MPL_TEST_CASE()
{
typedef list<int,long,char,char[50],double> types;
typedef list<
sizeof_<int>::type,
sizeof_<long>::type,
sizeof_<char>::type,
sizeof_<char[50]>::type,
sizeof_<double>::type
> sizes;
MPL_ASSERT(( equal< transform_view< types, sizeof_<_> >::type,sizes > ));
typedef max_element<
transform_view< types, sizeof_<_> >
>::type iter;