merge new MPL version from 'mplbook' branch

[SVN r24874]
This commit is contained in:
Aleksey Gurtovoy
2004-09-02 15:41:37 +00:00
parent e2e70427cc
commit 1689c8ef83
1216 changed files with 89913 additions and 36752 deletions
+60 -27
View File
@@ -1,21 +1,26 @@
//-----------------------------------------------------------------------------
// boost mpl/test/bind.cpp source file
// See http://www.boost.org for updates, documentation, and revision history.
//-----------------------------------------------------------------------------
// Copyright Peter Dimov 2001-2002
// Copyright Aleksey Gurtovoy 2001-2004
//
// Copyright (c) 2001-02
// Peter Dimov, Aleksey Gurtovoy
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// Distributed under the Boost Software License,Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/mpl for documentation.
#include "boost/mpl/bind.hpp"
#include "boost/mpl/apply.hpp"
#include "boost/mpl/assert_is_same.hpp"
#include "boost/type_traits/is_same.hpp"
// $Source$
// $Date$
// $Revision$
namespace mpl = boost::mpl;
#include <boost/mpl/bind.hpp>
#include <boost/mpl/quote.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/next.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/mpl/apply_wrap.hpp>
#include <boost/mpl/aux_/test.hpp>
#include <boost/type_traits/is_float.hpp>
namespace {
@@ -38,19 +43,47 @@ struct f5
} // namespace
int main()
MPL_TEST_CASE() // basic argument binding
{
using namespace mpl::placeholders;
typedef apply_wrap1< bind1<f1,_1>, int >::type r11;
typedef apply_wrap5< bind1<f1,_5>, void,void,void,void,int >::type r12;
MPL_ASSERT(( boost::is_same<r11,int> ));
MPL_ASSERT(( boost::is_same<r12,int> ));
typedef mpl::apply1< mpl::bind1<f1,_1>,int >::type r11;
typedef mpl::apply5< mpl::bind1<f1,_5>,void,void,void,void,int >::type r12;
BOOST_MPL_ASSERT_IS_SAME(r11,int);
BOOST_MPL_ASSERT_IS_SAME(r12,int);
typedef mpl::apply5< mpl::bind5<f5,_1,_2,_3,_4,_5>,void,void,void,void,int >::type r51;
typedef mpl::apply5< mpl::bind5<f5,_5,_4,_3,_2,_1>,int,void,void,void,void >::type r52;
BOOST_MPL_ASSERT_IS_SAME(r51,int);
BOOST_MPL_ASSERT_IS_SAME(r52,int);
return 0;
typedef apply_wrap5< bind5<f5,_1,_2,_3,_4,_5>, void,void,void,void,int >::type r51;
typedef apply_wrap5< bind5<f5,_5,_4,_3,_2,_1>, int,void,void,void,void >::type r52;
MPL_ASSERT(( boost::is_same<r51,int> ));
MPL_ASSERT(( boost::is_same<r52,int> ));
}
MPL_TEST_CASE() // fully bound metafunction classes
{
typedef apply_wrap0< bind1<f1,int> >::type r11;
typedef apply_wrap0< bind5<f5,void,void,void,void,int> >::type r51;
MPL_ASSERT(( boost::is_same<r11,int> ));
MPL_ASSERT(( boost::is_same<r51,int> ));
}
MPL_TEST_CASE() // metafunction class composition
{
typedef apply_wrap5< bind5<f5,_1,_2,_3,_4,bind1<f1,_1> >, int,void,void,void,void >::type r51;
typedef apply_wrap5< bind5<f5,_1,_2,_3,_4,bind1<f1,_5> >, void,void,void,void,int >::type r52;
MPL_ASSERT(( boost::is_same<r51,int> ));
MPL_ASSERT(( boost::is_same<r52,int> ));
}
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
&& !defined(BOOST_MPL_CFG_NO_TEMPLATE_TEMPLATE_PARAMETERS) \
&& !BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003))
MPL_TEST_CASE() // if_ evaluation
{
typedef bind3< quote3<if_>, _1, bind1< quote1<next>, _2>, _3 > f;
typedef apply_wrap3< f,true_,int_<0>,int >::type r1;
typedef apply_wrap3< f,false_,int,int_<0> >::type r2;
MPL_ASSERT(( boost::is_same<r1,int_<1> > ));
MPL_ASSERT(( boost::is_same<r2,int_<0> > ));
}
#endif