mpl::always is now nullary. Test is updated to take care of new possible calls using apply and apply0.

[SVN r71163]
This commit is contained in:
Joel Falcou
2011-04-10 11:27:54 +00:00
committed by Daniel James
parent 74fef329d4
commit 94154603ec
2 changed files with 11 additions and 6 deletions

View File

@@ -14,7 +14,7 @@
// $Date$
// $Revision$
#include <boost/mpl/aux_/preprocessor/def_params_tail.hpp>
#include <boost/mpl/aux_/preprocessor/default_params.hpp>
#include <boost/mpl/aux_/na.hpp>
#include <boost/mpl/aux_/arity_spec.hpp>
@@ -23,8 +23,7 @@ namespace boost { namespace mpl {
template< typename Value > struct always
{
template<
typename T
BOOST_MPL_PP_NESTED_DEF_PARAMS_TAIL(1, typename T, na)
BOOST_MPL_PP_DEFAULT_PARAMS(BOOST_MPL_LIMIT_METAFUNCTION_ARITY, typename T, na)
>
struct apply
{
@@ -32,7 +31,7 @@ template< typename Value > struct always
};
};
BOOST_MPL_AUX_ARITY_SPEC(1, always)
BOOST_MPL_AUX_ARITY_SPEC(0, always)
}}

View File

@@ -22,6 +22,8 @@ MPL_TEST_CASE()
{
typedef always<true_> always_true;
MPL_ASSERT(( apply< always_true > ));
MPL_ASSERT(( apply0< always_true > ));
MPL_ASSERT(( apply1< always_true,false_ > ));
MPL_ASSERT(( apply2< always_true,false_,false_ > ));
MPL_ASSERT(( apply3< always_true,false_,false_,false_ > ));
@@ -31,11 +33,15 @@ MPL_TEST_CASE()
MPL_TEST_CASE()
{
typedef always< int_<10> > always_10;
typedef apply< always_10 >::type res;
typedef apply0< always_10 >::type res0;
typedef apply1< always_10,int_<0> >::type res1;
typedef apply2< always_10,int_<0>,int_<0> >::type res2;
typedef apply3< always_10,int_<0>,int_<0>,int_<0> >::type res3;
MPL_ASSERT_RELATION( res::value, ==, 10 );
MPL_ASSERT_RELATION( res0::value, ==, 10 );
MPL_ASSERT_RELATION( res1::value, ==, 10 );
MPL_ASSERT_RELATION( res2::value, ==, 10 );
MPL_ASSERT_RELATION( res3::value, ==, 10 );