From 483eb2f56657e8e7f419ab1a4fab8dce9ade8609 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 20:24:20 +0200 Subject: Adding upstream version 14.2.21. Signed-off-by: Daniel Baumann --- src/boost/libs/mpl/test/bind.cpp | 89 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 src/boost/libs/mpl/test/bind.cpp (limited to 'src/boost/libs/mpl/test/bind.cpp') diff --git a/src/boost/libs/mpl/test/bind.cpp b/src/boost/libs/mpl/test/bind.cpp new file mode 100644 index 00000000..2a2de62c --- /dev/null +++ b/src/boost/libs/mpl/test/bind.cpp @@ -0,0 +1,89 @@ + +// Copyright Peter Dimov 2001-2002 +// Copyright Aleksey Gurtovoy 2001-2004 +// +// 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. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include +#include +#include +#include +#include +#include + +#include + +namespace { + +struct f1 +{ + template< typename T1 > struct apply + { + typedef T1 type; + }; +}; + +struct f5 +{ + template< typename T1, typename T2, typename T3, typename T4, typename T5 > + struct apply + { + typedef T5 type; + }; +}; + +} // namespace + +MPL_TEST_CASE() // basic argument binding +{ + typedef apply_wrap1< bind1, int >::type r11; + typedef apply_wrap5< bind1, void,void,void,void,int >::type r12; + MPL_ASSERT(( boost::is_same )); + MPL_ASSERT(( boost::is_same )); + + typedef apply_wrap5< bind5, void,void,void,void,int >::type r51; + typedef apply_wrap5< bind5, int,void,void,void,void >::type r52; + MPL_ASSERT(( boost::is_same )); + MPL_ASSERT(( boost::is_same )); +} + + +MPL_TEST_CASE() // fully bound metafunction classes +{ + typedef apply_wrap0< bind1 >::type r11; + typedef apply_wrap0< bind5 >::type r51; + MPL_ASSERT(( boost::is_same )); + MPL_ASSERT(( boost::is_same )); +} + + +MPL_TEST_CASE() // metafunction class composition +{ + typedef apply_wrap5< bind5 >, int,void,void,void,void >::type r51; + typedef apply_wrap5< bind5 >, void,void,void,void,int >::type r52; + MPL_ASSERT(( boost::is_same )); + MPL_ASSERT(( boost::is_same )); +} + +#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, _1, bind1< quote1, _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 > )); + MPL_ASSERT(( boost::is_same > )); +} +#endif -- cgit v1.2.3