From 0d06b02ab6cc6f4d7ee7fbd506824fa646d7dd86 Mon Sep 17 00:00:00 2001 From: Aleksey Gurtovoy Date: Tue, 17 Dec 2002 10:42:05 +0000 Subject: [PATCH] limited metafunction form support [SVN r16632] --- include/boost/mpl/aux_/full_lambda.hpp | 8 +- .../boost/mpl/aux_/has_type.hpp | 23 ++-- .../mpl/aux_/preprocessed/bcc/full_lambda.hpp | 20 ++-- .../mpl/aux_/preprocessed/bcc/meta_fun.hpp | 3 - .../boost/mpl/aux_/preprocessed/bcc/quote.hpp | 3 + .../aux_/preprocessed/bcc551/full_lambda.hpp | 20 ++-- .../mpl/aux_/preprocessed/bcc551/meta_fun.hpp | 3 - .../mpl/aux_/preprocessed/bcc551/quote.hpp | 3 + .../mpl/aux_/preprocessed/gcc/full_lambda.hpp | 20 ++-- .../{msvc70/meta_fun.hpp => gcc/quote.hpp} | 45 ++++++-- .../aux_/preprocessed/msvc60/full_lambda.hpp | 20 ++-- .../mpl/aux_/preprocessed/msvc60/meta_fun.hpp | 3 - .../mpl/aux_/preprocessed/msvc60/quote.hpp | 3 + .../aux_/preprocessed/msvc70/full_lambda.hpp | 20 ++-- .../meta_fun.hpp => msvc70/quote.hpp} | 53 +++++++-- .../aux_/preprocessed/mwcw/full_lambda.hpp | 20 ++-- .../mwcw/{meta_fun.hpp => quote.hpp} | 45 ++++++-- .../aux_/preprocessed/no_ctps/full_lambda.hpp | 20 ++-- .../mpl/aux_/preprocessed/no_ctps/quote.hpp | 106 ++++++++++++++++++ .../aux_/preprocessed/plain/full_lambda.hpp | 20 ++-- .../mpl/aux_/preprocessed/plain/meta_fun.hpp | 75 ------------- .../{gcc/meta_fun.hpp => plain/quote.hpp} | 45 ++++++-- include/boost/mpl/{meta_fun.hpp => quote.hpp} | 69 ++++++++++-- include/boost/mpl/v2_1/type_traits.hpp | 6 +- preprocessed/src/{meta_fun.cpp => quote.cpp} | 2 +- test/Jamfile | 3 +- test/count_if.cpp | 2 +- test/quote.cpp | 46 ++++++++ 28 files changed, 464 insertions(+), 242 deletions(-) rename test/meta_fun.cpp => include/boost/mpl/aux_/has_type.hpp (65%) delete mode 100644 include/boost/mpl/aux_/preprocessed/bcc/meta_fun.hpp create mode 100644 include/boost/mpl/aux_/preprocessed/bcc/quote.hpp delete mode 100644 include/boost/mpl/aux_/preprocessed/bcc551/meta_fun.hpp create mode 100644 include/boost/mpl/aux_/preprocessed/bcc551/quote.hpp rename include/boost/mpl/aux_/preprocessed/{msvc70/meta_fun.hpp => gcc/quote.hpp} (67%) delete mode 100644 include/boost/mpl/aux_/preprocessed/msvc60/meta_fun.hpp create mode 100644 include/boost/mpl/aux_/preprocessed/msvc60/quote.hpp rename include/boost/mpl/aux_/preprocessed/{no_ctps/meta_fun.hpp => msvc70/quote.hpp} (53%) rename include/boost/mpl/aux_/preprocessed/mwcw/{meta_fun.hpp => quote.hpp} (67%) create mode 100644 include/boost/mpl/aux_/preprocessed/no_ctps/quote.hpp delete mode 100644 include/boost/mpl/aux_/preprocessed/plain/meta_fun.hpp rename include/boost/mpl/aux_/preprocessed/{gcc/meta_fun.hpp => plain/quote.hpp} (67%) rename include/boost/mpl/{meta_fun.hpp => quote.hpp} (54%) rename preprocessed/src/{meta_fun.cpp => quote.cpp} (52%) create mode 100644 test/quote.cpp diff --git a/include/boost/mpl/aux_/full_lambda.hpp b/include/boost/mpl/aux_/full_lambda.hpp index f7cbb51..be98ec5 100644 --- a/include/boost/mpl/aux_/full_lambda.hpp +++ b/include/boost/mpl/aux_/full_lambda.hpp @@ -25,7 +25,7 @@ # include "boost/mpl/lambda_fwd.hpp" # include "boost/mpl/bind.hpp" # include "boost/mpl/protect.hpp" -# include "boost/mpl/meta_fun.hpp" +# include "boost/mpl/quote.hpp" # include "boost/mpl/bool_c.hpp" # include "boost/mpl/aux_/template_arity.hpp" # include "boost/mpl/aux_/config/ttp.hpp" @@ -230,7 +230,7 @@ template< struct BOOST_PP_CAT(le_result,i)< true,false,F,AUX_LAMBDA_PARAMS(i, L) > { typedef BOOST_PP_CAT(bind,i)< - BOOST_PP_CAT(meta_fun,i) + BOOST_PP_CAT(quote,i) , BOOST_MPL_PP_REPEAT(i, AUX_LAMBDA_RESULT, L) > type; }; @@ -242,7 +242,7 @@ template< struct BOOST_PP_CAT(le_result,i)< true,true,F,AUX_LAMBDA_PARAMS(i, L) > { typedef protect< BOOST_PP_CAT(bind,i)< - BOOST_PP_CAT(meta_fun,i) + BOOST_PP_CAT(quote,i) , BOOST_MPL_PP_REPEAT(i, AUX_LAMBDA_RESULT, L) > > type; }; @@ -328,7 +328,7 @@ struct lambda_impl< F, Protect AUX_LAMBDA_IMPL_ARITY > /**/ typedef BOOST_PP_CAT(bind,i)< - BOOST_PP_CAT(meta_fun,i) + BOOST_PP_CAT(quote,i) , BOOST_MPL_PP_REPEAT(i, AUX_LAMBDA_INVOCATION, T) > type; diff --git a/test/meta_fun.cpp b/include/boost/mpl/aux_/has_type.hpp similarity index 65% rename from test/meta_fun.cpp rename to include/boost/mpl/aux_/has_type.hpp index 79a7f28..a0a59a1 100644 --- a/test/meta_fun.cpp +++ b/include/boost/mpl/aux_/has_type.hpp @@ -1,9 +1,9 @@ //----------------------------------------------------------------------------- -// boost mpl/test/meta_fun.cpp source file +// boost mpl/aux_/has_type.hpp header file // See http://www.boost.org for updates, documentation, and revision history. //----------------------------------------------------------------------------- // -// Copyright (c) 2000-02 +// Copyright (c) 2002 // Aleksey Gurtovoy // // Permission to use, copy, modify, distribute and sell this software @@ -14,18 +14,13 @@ // suitability of this software for any purpose. It is provided "as is" // without express or implied warranty. -#include "boost/mpl/meta_fun.hpp" -#include "boost/mpl/assert_is_same.hpp" +#ifndef BOOST_MPL_AUX_HAS_TYPE_HPP_INCLUDED +#define BOOST_MPL_AUX_HAS_TYPE_HPP_INCLUDED -namespace mpl = boost::mpl; +#include "boost/mpl/aux_/has_xxx.hpp" -template struct f1; -template struct f5; +namespace boost { namespace mpl { namespace aux { +BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(has_type, type, true) +}}} -int main() -{ - typedef mpl::meta_fun1 fc1; - typedef mpl::meta_fun5 fc5; - - return 0; -} +#endif // BOOST_MPL_AUX_HAS_TYPE_HPP_INCLUDED diff --git a/include/boost/mpl/aux_/preprocessed/bcc/full_lambda.hpp b/include/boost/mpl/aux_/preprocessed/bcc/full_lambda.hpp index bfa5bce..e80418e 100644 --- a/include/boost/mpl/aux_/preprocessed/bcc/full_lambda.hpp +++ b/include/boost/mpl/aux_/preprocessed/bcc/full_lambda.hpp @@ -87,7 +87,7 @@ template< struct le_result1< true,false,F,L1 > { typedef bind1< - meta_fun1 + quote1 , typename L1::type > type; }; @@ -99,7 +99,7 @@ template< struct le_result1< true,true,F,L1 > { typedef protect< bind1< - meta_fun1 + quote1 , typename L1::type > > type; }; @@ -202,7 +202,7 @@ template< struct le_result2< true,false,F,L1,L2 > { typedef bind2< - meta_fun2 + quote2 , typename L1::type, typename L2::type > type; }; @@ -214,7 +214,7 @@ template< struct le_result2< true,true,F,L1,L2 > { typedef protect< bind2< - meta_fun2 + quote2 , typename L1::type, typename L2::type > > type; }; @@ -321,7 +321,7 @@ template< struct le_result3< true,false,F,L1,L2,L3 > { typedef bind3< - meta_fun3 + quote3 , typename L1::type, typename L2::type, typename L3::type > type; }; @@ -333,7 +333,7 @@ template< struct le_result3< true,true,F,L1,L2,L3 > { typedef protect< bind3< - meta_fun3 + quote3 , typename L1::type, typename L2::type, typename L3::type > > type; }; @@ -443,7 +443,7 @@ template< struct le_result4< true,false,F,L1,L2,L3,L4 > { typedef bind4< - meta_fun4 + quote4 , typename L1::type, typename L2::type, typename L3::type , typename L4::type > type; @@ -456,7 +456,7 @@ template< struct le_result4< true,true,F,L1,L2,L3,L4 > { typedef protect< bind4< - meta_fun4 + quote4 , typename L1::type, typename L2::type, typename L3::type , typename L4::type > > type; @@ -575,7 +575,7 @@ template< struct le_result5< true,false,F,L1,L2,L3,L4,L5 > { typedef bind5< - meta_fun5 + quote5 , typename L1::type, typename L2::type, typename L3::type , typename L4::type, typename L5::type > type; @@ -592,7 +592,7 @@ template< struct le_result5< true,true,F,L1,L2,L3,L4,L5 > { typedef protect< bind5< - meta_fun5 + quote5 , typename L1::type, typename L2::type, typename L3::type , typename L4::type, typename L5::type > > type; diff --git a/include/boost/mpl/aux_/preprocessed/bcc/meta_fun.hpp b/include/boost/mpl/aux_/preprocessed/bcc/meta_fun.hpp deleted file mode 100644 index 050f317..0000000 --- a/include/boost/mpl/aux_/preprocessed/bcc/meta_fun.hpp +++ /dev/null @@ -1,3 +0,0 @@ -// preprocessed version of 'boost/mpl/meta_fun.hpp' header -// see the original for copyright information - diff --git a/include/boost/mpl/aux_/preprocessed/bcc/quote.hpp b/include/boost/mpl/aux_/preprocessed/bcc/quote.hpp new file mode 100644 index 0000000..902c44e --- /dev/null +++ b/include/boost/mpl/aux_/preprocessed/bcc/quote.hpp @@ -0,0 +1,3 @@ +// preprocessed version of 'boost/mpl/quote.hpp' header +// see the original for copyright information + diff --git a/include/boost/mpl/aux_/preprocessed/bcc551/full_lambda.hpp b/include/boost/mpl/aux_/preprocessed/bcc551/full_lambda.hpp index bfa5bce..e80418e 100644 --- a/include/boost/mpl/aux_/preprocessed/bcc551/full_lambda.hpp +++ b/include/boost/mpl/aux_/preprocessed/bcc551/full_lambda.hpp @@ -87,7 +87,7 @@ template< struct le_result1< true,false,F,L1 > { typedef bind1< - meta_fun1 + quote1 , typename L1::type > type; }; @@ -99,7 +99,7 @@ template< struct le_result1< true,true,F,L1 > { typedef protect< bind1< - meta_fun1 + quote1 , typename L1::type > > type; }; @@ -202,7 +202,7 @@ template< struct le_result2< true,false,F,L1,L2 > { typedef bind2< - meta_fun2 + quote2 , typename L1::type, typename L2::type > type; }; @@ -214,7 +214,7 @@ template< struct le_result2< true,true,F,L1,L2 > { typedef protect< bind2< - meta_fun2 + quote2 , typename L1::type, typename L2::type > > type; }; @@ -321,7 +321,7 @@ template< struct le_result3< true,false,F,L1,L2,L3 > { typedef bind3< - meta_fun3 + quote3 , typename L1::type, typename L2::type, typename L3::type > type; }; @@ -333,7 +333,7 @@ template< struct le_result3< true,true,F,L1,L2,L3 > { typedef protect< bind3< - meta_fun3 + quote3 , typename L1::type, typename L2::type, typename L3::type > > type; }; @@ -443,7 +443,7 @@ template< struct le_result4< true,false,F,L1,L2,L3,L4 > { typedef bind4< - meta_fun4 + quote4 , typename L1::type, typename L2::type, typename L3::type , typename L4::type > type; @@ -456,7 +456,7 @@ template< struct le_result4< true,true,F,L1,L2,L3,L4 > { typedef protect< bind4< - meta_fun4 + quote4 , typename L1::type, typename L2::type, typename L3::type , typename L4::type > > type; @@ -575,7 +575,7 @@ template< struct le_result5< true,false,F,L1,L2,L3,L4,L5 > { typedef bind5< - meta_fun5 + quote5 , typename L1::type, typename L2::type, typename L3::type , typename L4::type, typename L5::type > type; @@ -592,7 +592,7 @@ template< struct le_result5< true,true,F,L1,L2,L3,L4,L5 > { typedef protect< bind5< - meta_fun5 + quote5 , typename L1::type, typename L2::type, typename L3::type , typename L4::type, typename L5::type > > type; diff --git a/include/boost/mpl/aux_/preprocessed/bcc551/meta_fun.hpp b/include/boost/mpl/aux_/preprocessed/bcc551/meta_fun.hpp deleted file mode 100644 index 050f317..0000000 --- a/include/boost/mpl/aux_/preprocessed/bcc551/meta_fun.hpp +++ /dev/null @@ -1,3 +0,0 @@ -// preprocessed version of 'boost/mpl/meta_fun.hpp' header -// see the original for copyright information - diff --git a/include/boost/mpl/aux_/preprocessed/bcc551/quote.hpp b/include/boost/mpl/aux_/preprocessed/bcc551/quote.hpp new file mode 100644 index 0000000..902c44e --- /dev/null +++ b/include/boost/mpl/aux_/preprocessed/bcc551/quote.hpp @@ -0,0 +1,3 @@ +// preprocessed version of 'boost/mpl/quote.hpp' header +// see the original for copyright information + diff --git a/include/boost/mpl/aux_/preprocessed/gcc/full_lambda.hpp b/include/boost/mpl/aux_/preprocessed/gcc/full_lambda.hpp index bfa5bce..e80418e 100644 --- a/include/boost/mpl/aux_/preprocessed/gcc/full_lambda.hpp +++ b/include/boost/mpl/aux_/preprocessed/gcc/full_lambda.hpp @@ -87,7 +87,7 @@ template< struct le_result1< true,false,F,L1 > { typedef bind1< - meta_fun1 + quote1 , typename L1::type > type; }; @@ -99,7 +99,7 @@ template< struct le_result1< true,true,F,L1 > { typedef protect< bind1< - meta_fun1 + quote1 , typename L1::type > > type; }; @@ -202,7 +202,7 @@ template< struct le_result2< true,false,F,L1,L2 > { typedef bind2< - meta_fun2 + quote2 , typename L1::type, typename L2::type > type; }; @@ -214,7 +214,7 @@ template< struct le_result2< true,true,F,L1,L2 > { typedef protect< bind2< - meta_fun2 + quote2 , typename L1::type, typename L2::type > > type; }; @@ -321,7 +321,7 @@ template< struct le_result3< true,false,F,L1,L2,L3 > { typedef bind3< - meta_fun3 + quote3 , typename L1::type, typename L2::type, typename L3::type > type; }; @@ -333,7 +333,7 @@ template< struct le_result3< true,true,F,L1,L2,L3 > { typedef protect< bind3< - meta_fun3 + quote3 , typename L1::type, typename L2::type, typename L3::type > > type; }; @@ -443,7 +443,7 @@ template< struct le_result4< true,false,F,L1,L2,L3,L4 > { typedef bind4< - meta_fun4 + quote4 , typename L1::type, typename L2::type, typename L3::type , typename L4::type > type; @@ -456,7 +456,7 @@ template< struct le_result4< true,true,F,L1,L2,L3,L4 > { typedef protect< bind4< - meta_fun4 + quote4 , typename L1::type, typename L2::type, typename L3::type , typename L4::type > > type; @@ -575,7 +575,7 @@ template< struct le_result5< true,false,F,L1,L2,L3,L4,L5 > { typedef bind5< - meta_fun5 + quote5 , typename L1::type, typename L2::type, typename L3::type , typename L4::type, typename L5::type > type; @@ -592,7 +592,7 @@ template< struct le_result5< true,true,F,L1,L2,L3,L4,L5 > { typedef protect< bind5< - meta_fun5 + quote5 , typename L1::type, typename L2::type, typename L3::type , typename L4::type, typename L5::type > > type; diff --git a/include/boost/mpl/aux_/preprocessed/msvc70/meta_fun.hpp b/include/boost/mpl/aux_/preprocessed/gcc/quote.hpp similarity index 67% rename from include/boost/mpl/aux_/preprocessed/msvc70/meta_fun.hpp rename to include/boost/mpl/aux_/preprocessed/gcc/quote.hpp index befe244..0a8e644 100644 --- a/include/boost/mpl/aux_/preprocessed/msvc70/meta_fun.hpp +++ b/include/boost/mpl/aux_/preprocessed/gcc/quote.hpp @@ -1,16 +1,31 @@ -// preprocessed version of 'boost/mpl/meta_fun.hpp' header +// preprocessed version of 'boost/mpl/quote.hpp' header // see the original for copyright information namespace boost { namespace mpl { +template< typename T, bool has_type_ = aux::has_type::value > +struct quote_impl + + : T +{ +}; + +template< typename T > +struct quote_impl< T,false > +{ + typedef T type; +}; + template< template< typename P1 > class F > -struct meta_fun1 +struct quote1 { template< typename U1 > struct apply - : F + + : quote_impl< F > + { }; }; @@ -18,10 +33,12 @@ struct meta_fun1 template< template< typename P1, typename P2 > class F > -struct meta_fun2 +struct quote2 { template< typename U1, typename U2 > struct apply - : F< U1,U2 > + + : quote_impl< F > + { }; }; @@ -29,10 +46,12 @@ struct meta_fun2 template< template< typename P1, typename P2, typename P3 > class F > -struct meta_fun3 +struct quote3 { template< typename U1, typename U2, typename U3 > struct apply - : F< U1,U2,U3 > + + : quote_impl< F > + { }; }; @@ -40,13 +59,15 @@ struct meta_fun3 template< template< typename P1, typename P2, typename P3, typename P4 > class F > -struct meta_fun4 +struct quote4 { template< typename U1, typename U2, typename U3, typename U4 > struct apply - : F< U1,U2,U3,U4 > + + : quote_impl< F > + { }; }; @@ -58,14 +79,16 @@ template< > class F > -struct meta_fun5 +struct quote5 { template< typename U1, typename U2, typename U3, typename U4 , typename U5 > struct apply - : F< U1,U2,U3,U4,U5 > + + : quote_impl< F > + { }; }; diff --git a/include/boost/mpl/aux_/preprocessed/msvc60/full_lambda.hpp b/include/boost/mpl/aux_/preprocessed/msvc60/full_lambda.hpp index c9813c6..d268515 100644 --- a/include/boost/mpl/aux_/preprocessed/msvc60/full_lambda.hpp +++ b/include/boost/mpl/aux_/preprocessed/msvc60/full_lambda.hpp @@ -87,7 +87,7 @@ template< struct le_result1< true,false,F,L1 > { typedef bind1< - meta_fun1 + quote1 , typename L1::type > type; }; @@ -99,7 +99,7 @@ template< struct le_result1< true,true,F,L1 > { typedef protect< bind1< - meta_fun1 + quote1 , typename L1::type > > type; }; @@ -173,7 +173,7 @@ template< struct le_result2< true,false,F,L1,L2 > { typedef bind2< - meta_fun2 + quote2 , typename L1::type, typename L2::type > type; }; @@ -185,7 +185,7 @@ template< struct le_result2< true,true,F,L1,L2 > { typedef protect< bind2< - meta_fun2 + quote2 , typename L1::type, typename L2::type > > type; }; @@ -261,7 +261,7 @@ template< struct le_result3< true,false,F,L1,L2,L3 > { typedef bind3< - meta_fun3 + quote3 , typename L1::type, typename L2::type, typename L3::type > type; }; @@ -273,7 +273,7 @@ template< struct le_result3< true,true,F,L1,L2,L3 > { typedef protect< bind3< - meta_fun3 + quote3 , typename L1::type, typename L2::type, typename L3::type > > type; }; @@ -351,7 +351,7 @@ template< struct le_result4< true,false,F,L1,L2,L3,L4 > { typedef bind4< - meta_fun4 + quote4 , typename L1::type, typename L2::type, typename L3::type , typename L4::type > type; @@ -364,7 +364,7 @@ template< struct le_result4< true,true,F,L1,L2,L3,L4 > { typedef protect< bind4< - meta_fun4 + quote4 , typename L1::type, typename L2::type, typename L3::type , typename L4::type > > type; @@ -449,7 +449,7 @@ template< struct le_result5< true,false,F,L1,L2,L3,L4,L5 > { typedef bind5< - meta_fun5 + quote5 , typename L1::type, typename L2::type, typename L3::type , typename L4::type, typename L5::type > type; @@ -466,7 +466,7 @@ template< struct le_result5< true,true,F,L1,L2,L3,L4,L5 > { typedef protect< bind5< - meta_fun5 + quote5 , typename L1::type, typename L2::type, typename L3::type , typename L4::type, typename L5::type > > type; diff --git a/include/boost/mpl/aux_/preprocessed/msvc60/meta_fun.hpp b/include/boost/mpl/aux_/preprocessed/msvc60/meta_fun.hpp deleted file mode 100644 index 050f317..0000000 --- a/include/boost/mpl/aux_/preprocessed/msvc60/meta_fun.hpp +++ /dev/null @@ -1,3 +0,0 @@ -// preprocessed version of 'boost/mpl/meta_fun.hpp' header -// see the original for copyright information - diff --git a/include/boost/mpl/aux_/preprocessed/msvc60/quote.hpp b/include/boost/mpl/aux_/preprocessed/msvc60/quote.hpp new file mode 100644 index 0000000..902c44e --- /dev/null +++ b/include/boost/mpl/aux_/preprocessed/msvc60/quote.hpp @@ -0,0 +1,3 @@ +// preprocessed version of 'boost/mpl/quote.hpp' header +// see the original for copyright information + diff --git a/include/boost/mpl/aux_/preprocessed/msvc70/full_lambda.hpp b/include/boost/mpl/aux_/preprocessed/msvc70/full_lambda.hpp index c9813c6..d268515 100644 --- a/include/boost/mpl/aux_/preprocessed/msvc70/full_lambda.hpp +++ b/include/boost/mpl/aux_/preprocessed/msvc70/full_lambda.hpp @@ -87,7 +87,7 @@ template< struct le_result1< true,false,F,L1 > { typedef bind1< - meta_fun1 + quote1 , typename L1::type > type; }; @@ -99,7 +99,7 @@ template< struct le_result1< true,true,F,L1 > { typedef protect< bind1< - meta_fun1 + quote1 , typename L1::type > > type; }; @@ -173,7 +173,7 @@ template< struct le_result2< true,false,F,L1,L2 > { typedef bind2< - meta_fun2 + quote2 , typename L1::type, typename L2::type > type; }; @@ -185,7 +185,7 @@ template< struct le_result2< true,true,F,L1,L2 > { typedef protect< bind2< - meta_fun2 + quote2 , typename L1::type, typename L2::type > > type; }; @@ -261,7 +261,7 @@ template< struct le_result3< true,false,F,L1,L2,L3 > { typedef bind3< - meta_fun3 + quote3 , typename L1::type, typename L2::type, typename L3::type > type; }; @@ -273,7 +273,7 @@ template< struct le_result3< true,true,F,L1,L2,L3 > { typedef protect< bind3< - meta_fun3 + quote3 , typename L1::type, typename L2::type, typename L3::type > > type; }; @@ -351,7 +351,7 @@ template< struct le_result4< true,false,F,L1,L2,L3,L4 > { typedef bind4< - meta_fun4 + quote4 , typename L1::type, typename L2::type, typename L3::type , typename L4::type > type; @@ -364,7 +364,7 @@ template< struct le_result4< true,true,F,L1,L2,L3,L4 > { typedef protect< bind4< - meta_fun4 + quote4 , typename L1::type, typename L2::type, typename L3::type , typename L4::type > > type; @@ -449,7 +449,7 @@ template< struct le_result5< true,false,F,L1,L2,L3,L4,L5 > { typedef bind5< - meta_fun5 + quote5 , typename L1::type, typename L2::type, typename L3::type , typename L4::type, typename L5::type > type; @@ -466,7 +466,7 @@ template< struct le_result5< true,true,F,L1,L2,L3,L4,L5 > { typedef protect< bind5< - meta_fun5 + quote5 , typename L1::type, typename L2::type, typename L3::type , typename L4::type, typename L5::type > > type; diff --git a/include/boost/mpl/aux_/preprocessed/no_ctps/meta_fun.hpp b/include/boost/mpl/aux_/preprocessed/msvc70/quote.hpp similarity index 53% rename from include/boost/mpl/aux_/preprocessed/no_ctps/meta_fun.hpp rename to include/boost/mpl/aux_/preprocessed/msvc70/quote.hpp index befe244..4a8a6cc 100644 --- a/include/boost/mpl/aux_/preprocessed/no_ctps/meta_fun.hpp +++ b/include/boost/mpl/aux_/preprocessed/msvc70/quote.hpp @@ -1,16 +1,35 @@ -// preprocessed version of 'boost/mpl/meta_fun.hpp' header +// preprocessed version of 'boost/mpl/quote.hpp' header // see the original for copyright information namespace boost { namespace mpl { +template< bool > struct quote_impl +{ + template< typename T > struct result_ + : T + { + }; +}; + +template<> struct quote_impl +{ + template< typename T > struct result_ + { + typedef T type; + }; +}; + template< template< typename P1 > class F > -struct meta_fun1 +struct quote1 { template< typename U1 > struct apply - : F + + : quote_impl< aux::has_type< F >::value > + ::template result_< F > + { }; }; @@ -18,10 +37,13 @@ struct meta_fun1 template< template< typename P1, typename P2 > class F > -struct meta_fun2 +struct quote2 { template< typename U1, typename U2 > struct apply - : F< U1,U2 > + + : quote_impl< aux::has_type< F >::value > + ::template result_< F > + { }; }; @@ -29,10 +51,13 @@ struct meta_fun2 template< template< typename P1, typename P2, typename P3 > class F > -struct meta_fun3 +struct quote3 { template< typename U1, typename U2, typename U3 > struct apply - : F< U1,U2,U3 > + + : quote_impl< aux::has_type< F >::value > + ::template result_< F > + { }; }; @@ -40,13 +65,16 @@ struct meta_fun3 template< template< typename P1, typename P2, typename P3, typename P4 > class F > -struct meta_fun4 +struct quote4 { template< typename U1, typename U2, typename U3, typename U4 > struct apply - : F< U1,U2,U3,U4 > + + : quote_impl< aux::has_type< F >::value > + ::template result_< F > + { }; }; @@ -58,14 +86,17 @@ template< > class F > -struct meta_fun5 +struct quote5 { template< typename U1, typename U2, typename U3, typename U4 , typename U5 > struct apply - : F< U1,U2,U3,U4,U5 > + + : quote_impl< aux::has_type< F >::value > + ::template result_< F > + { }; }; diff --git a/include/boost/mpl/aux_/preprocessed/mwcw/full_lambda.hpp b/include/boost/mpl/aux_/preprocessed/mwcw/full_lambda.hpp index c9813c6..d268515 100644 --- a/include/boost/mpl/aux_/preprocessed/mwcw/full_lambda.hpp +++ b/include/boost/mpl/aux_/preprocessed/mwcw/full_lambda.hpp @@ -87,7 +87,7 @@ template< struct le_result1< true,false,F,L1 > { typedef bind1< - meta_fun1 + quote1 , typename L1::type > type; }; @@ -99,7 +99,7 @@ template< struct le_result1< true,true,F,L1 > { typedef protect< bind1< - meta_fun1 + quote1 , typename L1::type > > type; }; @@ -173,7 +173,7 @@ template< struct le_result2< true,false,F,L1,L2 > { typedef bind2< - meta_fun2 + quote2 , typename L1::type, typename L2::type > type; }; @@ -185,7 +185,7 @@ template< struct le_result2< true,true,F,L1,L2 > { typedef protect< bind2< - meta_fun2 + quote2 , typename L1::type, typename L2::type > > type; }; @@ -261,7 +261,7 @@ template< struct le_result3< true,false,F,L1,L2,L3 > { typedef bind3< - meta_fun3 + quote3 , typename L1::type, typename L2::type, typename L3::type > type; }; @@ -273,7 +273,7 @@ template< struct le_result3< true,true,F,L1,L2,L3 > { typedef protect< bind3< - meta_fun3 + quote3 , typename L1::type, typename L2::type, typename L3::type > > type; }; @@ -351,7 +351,7 @@ template< struct le_result4< true,false,F,L1,L2,L3,L4 > { typedef bind4< - meta_fun4 + quote4 , typename L1::type, typename L2::type, typename L3::type , typename L4::type > type; @@ -364,7 +364,7 @@ template< struct le_result4< true,true,F,L1,L2,L3,L4 > { typedef protect< bind4< - meta_fun4 + quote4 , typename L1::type, typename L2::type, typename L3::type , typename L4::type > > type; @@ -449,7 +449,7 @@ template< struct le_result5< true,false,F,L1,L2,L3,L4,L5 > { typedef bind5< - meta_fun5 + quote5 , typename L1::type, typename L2::type, typename L3::type , typename L4::type, typename L5::type > type; @@ -466,7 +466,7 @@ template< struct le_result5< true,true,F,L1,L2,L3,L4,L5 > { typedef protect< bind5< - meta_fun5 + quote5 , typename L1::type, typename L2::type, typename L3::type , typename L4::type, typename L5::type > > type; diff --git a/include/boost/mpl/aux_/preprocessed/mwcw/meta_fun.hpp b/include/boost/mpl/aux_/preprocessed/mwcw/quote.hpp similarity index 67% rename from include/boost/mpl/aux_/preprocessed/mwcw/meta_fun.hpp rename to include/boost/mpl/aux_/preprocessed/mwcw/quote.hpp index befe244..0a8e644 100644 --- a/include/boost/mpl/aux_/preprocessed/mwcw/meta_fun.hpp +++ b/include/boost/mpl/aux_/preprocessed/mwcw/quote.hpp @@ -1,16 +1,31 @@ -// preprocessed version of 'boost/mpl/meta_fun.hpp' header +// preprocessed version of 'boost/mpl/quote.hpp' header // see the original for copyright information namespace boost { namespace mpl { +template< typename T, bool has_type_ = aux::has_type::value > +struct quote_impl + + : T +{ +}; + +template< typename T > +struct quote_impl< T,false > +{ + typedef T type; +}; + template< template< typename P1 > class F > -struct meta_fun1 +struct quote1 { template< typename U1 > struct apply - : F + + : quote_impl< F > + { }; }; @@ -18,10 +33,12 @@ struct meta_fun1 template< template< typename P1, typename P2 > class F > -struct meta_fun2 +struct quote2 { template< typename U1, typename U2 > struct apply - : F< U1,U2 > + + : quote_impl< F > + { }; }; @@ -29,10 +46,12 @@ struct meta_fun2 template< template< typename P1, typename P2, typename P3 > class F > -struct meta_fun3 +struct quote3 { template< typename U1, typename U2, typename U3 > struct apply - : F< U1,U2,U3 > + + : quote_impl< F > + { }; }; @@ -40,13 +59,15 @@ struct meta_fun3 template< template< typename P1, typename P2, typename P3, typename P4 > class F > -struct meta_fun4 +struct quote4 { template< typename U1, typename U2, typename U3, typename U4 > struct apply - : F< U1,U2,U3,U4 > + + : quote_impl< F > + { }; }; @@ -58,14 +79,16 @@ template< > class F > -struct meta_fun5 +struct quote5 { template< typename U1, typename U2, typename U3, typename U4 , typename U5 > struct apply - : F< U1,U2,U3,U4,U5 > + + : quote_impl< F > + { }; }; diff --git a/include/boost/mpl/aux_/preprocessed/no_ctps/full_lambda.hpp b/include/boost/mpl/aux_/preprocessed/no_ctps/full_lambda.hpp index c9813c6..d268515 100644 --- a/include/boost/mpl/aux_/preprocessed/no_ctps/full_lambda.hpp +++ b/include/boost/mpl/aux_/preprocessed/no_ctps/full_lambda.hpp @@ -87,7 +87,7 @@ template< struct le_result1< true,false,F,L1 > { typedef bind1< - meta_fun1 + quote1 , typename L1::type > type; }; @@ -99,7 +99,7 @@ template< struct le_result1< true,true,F,L1 > { typedef protect< bind1< - meta_fun1 + quote1 , typename L1::type > > type; }; @@ -173,7 +173,7 @@ template< struct le_result2< true,false,F,L1,L2 > { typedef bind2< - meta_fun2 + quote2 , typename L1::type, typename L2::type > type; }; @@ -185,7 +185,7 @@ template< struct le_result2< true,true,F,L1,L2 > { typedef protect< bind2< - meta_fun2 + quote2 , typename L1::type, typename L2::type > > type; }; @@ -261,7 +261,7 @@ template< struct le_result3< true,false,F,L1,L2,L3 > { typedef bind3< - meta_fun3 + quote3 , typename L1::type, typename L2::type, typename L3::type > type; }; @@ -273,7 +273,7 @@ template< struct le_result3< true,true,F,L1,L2,L3 > { typedef protect< bind3< - meta_fun3 + quote3 , typename L1::type, typename L2::type, typename L3::type > > type; }; @@ -351,7 +351,7 @@ template< struct le_result4< true,false,F,L1,L2,L3,L4 > { typedef bind4< - meta_fun4 + quote4 , typename L1::type, typename L2::type, typename L3::type , typename L4::type > type; @@ -364,7 +364,7 @@ template< struct le_result4< true,true,F,L1,L2,L3,L4 > { typedef protect< bind4< - meta_fun4 + quote4 , typename L1::type, typename L2::type, typename L3::type , typename L4::type > > type; @@ -449,7 +449,7 @@ template< struct le_result5< true,false,F,L1,L2,L3,L4,L5 > { typedef bind5< - meta_fun5 + quote5 , typename L1::type, typename L2::type, typename L3::type , typename L4::type, typename L5::type > type; @@ -466,7 +466,7 @@ template< struct le_result5< true,true,F,L1,L2,L3,L4,L5 > { typedef protect< bind5< - meta_fun5 + quote5 , typename L1::type, typename L2::type, typename L3::type , typename L4::type, typename L5::type > > type; diff --git a/include/boost/mpl/aux_/preprocessed/no_ctps/quote.hpp b/include/boost/mpl/aux_/preprocessed/no_ctps/quote.hpp new file mode 100644 index 0000000..4a8a6cc --- /dev/null +++ b/include/boost/mpl/aux_/preprocessed/no_ctps/quote.hpp @@ -0,0 +1,106 @@ +// preprocessed version of 'boost/mpl/quote.hpp' header +// see the original for copyright information + +namespace boost { +namespace mpl { + +template< bool > struct quote_impl +{ + template< typename T > struct result_ + : T + { + }; +}; + +template<> struct quote_impl +{ + template< typename T > struct result_ + { + typedef T type; + }; +}; + +template< + template< typename P1 > class F + > +struct quote1 +{ + template< typename U1 > struct apply + + : quote_impl< aux::has_type< F >::value > + ::template result_< F > + + { + }; +}; + +template< + template< typename P1, typename P2 > class F + > +struct quote2 +{ + template< typename U1, typename U2 > struct apply + + : quote_impl< aux::has_type< F >::value > + ::template result_< F > + + { + }; +}; + +template< + template< typename P1, typename P2, typename P3 > class F + > +struct quote3 +{ + template< typename U1, typename U2, typename U3 > struct apply + + : quote_impl< aux::has_type< F >::value > + ::template result_< F > + + { + }; +}; + +template< + template< typename P1, typename P2, typename P3, typename P4 > class F + > +struct quote4 +{ + template< + typename U1, typename U2, typename U3, typename U4 + > + struct apply + + : quote_impl< aux::has_type< F >::value > + ::template result_< F > + + { + }; +}; + +template< + template< + typename P1, typename P2, typename P3, typename P4 + , typename P5 + > + class F + > +struct quote5 +{ + template< + typename U1, typename U2, typename U3, typename U4 + , typename U5 + > + struct apply + + : quote_impl< aux::has_type< F >::value > + ::template result_< F > + + { + }; +}; + +} // namespace mpl +} // namespace boost + diff --git a/include/boost/mpl/aux_/preprocessed/plain/full_lambda.hpp b/include/boost/mpl/aux_/preprocessed/plain/full_lambda.hpp index c9813c6..d268515 100644 --- a/include/boost/mpl/aux_/preprocessed/plain/full_lambda.hpp +++ b/include/boost/mpl/aux_/preprocessed/plain/full_lambda.hpp @@ -87,7 +87,7 @@ template< struct le_result1< true,false,F,L1 > { typedef bind1< - meta_fun1 + quote1 , typename L1::type > type; }; @@ -99,7 +99,7 @@ template< struct le_result1< true,true,F,L1 > { typedef protect< bind1< - meta_fun1 + quote1 , typename L1::type > > type; }; @@ -173,7 +173,7 @@ template< struct le_result2< true,false,F,L1,L2 > { typedef bind2< - meta_fun2 + quote2 , typename L1::type, typename L2::type > type; }; @@ -185,7 +185,7 @@ template< struct le_result2< true,true,F,L1,L2 > { typedef protect< bind2< - meta_fun2 + quote2 , typename L1::type, typename L2::type > > type; }; @@ -261,7 +261,7 @@ template< struct le_result3< true,false,F,L1,L2,L3 > { typedef bind3< - meta_fun3 + quote3 , typename L1::type, typename L2::type, typename L3::type > type; }; @@ -273,7 +273,7 @@ template< struct le_result3< true,true,F,L1,L2,L3 > { typedef protect< bind3< - meta_fun3 + quote3 , typename L1::type, typename L2::type, typename L3::type > > type; }; @@ -351,7 +351,7 @@ template< struct le_result4< true,false,F,L1,L2,L3,L4 > { typedef bind4< - meta_fun4 + quote4 , typename L1::type, typename L2::type, typename L3::type , typename L4::type > type; @@ -364,7 +364,7 @@ template< struct le_result4< true,true,F,L1,L2,L3,L4 > { typedef protect< bind4< - meta_fun4 + quote4 , typename L1::type, typename L2::type, typename L3::type , typename L4::type > > type; @@ -449,7 +449,7 @@ template< struct le_result5< true,false,F,L1,L2,L3,L4,L5 > { typedef bind5< - meta_fun5 + quote5 , typename L1::type, typename L2::type, typename L3::type , typename L4::type, typename L5::type > type; @@ -466,7 +466,7 @@ template< struct le_result5< true,true,F,L1,L2,L3,L4,L5 > { typedef protect< bind5< - meta_fun5 + quote5 , typename L1::type, typename L2::type, typename L3::type , typename L4::type, typename L5::type > > type; diff --git a/include/boost/mpl/aux_/preprocessed/plain/meta_fun.hpp b/include/boost/mpl/aux_/preprocessed/plain/meta_fun.hpp deleted file mode 100644 index befe244..0000000 --- a/include/boost/mpl/aux_/preprocessed/plain/meta_fun.hpp +++ /dev/null @@ -1,75 +0,0 @@ -// preprocessed version of 'boost/mpl/meta_fun.hpp' header -// see the original for copyright information - -namespace boost { -namespace mpl { - -template< - template< typename P1 > class F - > -struct meta_fun1 -{ - template< typename U1 > struct apply - : F - { - }; -}; - -template< - template< typename P1, typename P2 > class F - > -struct meta_fun2 -{ - template< typename U1, typename U2 > struct apply - : F< U1,U2 > - { - }; -}; - -template< - template< typename P1, typename P2, typename P3 > class F - > -struct meta_fun3 -{ - template< typename U1, typename U2, typename U3 > struct apply - : F< U1,U2,U3 > - { - }; -}; - -template< - template< typename P1, typename P2, typename P3, typename P4 > class F - > -struct meta_fun4 -{ - template< - typename U1, typename U2, typename U3, typename U4 - > - struct apply - : F< U1,U2,U3,U4 > - { - }; -}; - -template< - template< - typename P1, typename P2, typename P3, typename P4 - , typename P5 - > - class F - > -struct meta_fun5 -{ - template< - typename U1, typename U2, typename U3, typename U4 - , typename U5 - > - struct apply - : F< U1,U2,U3,U4,U5 > - { - }; -}; - -} // namespace mpl -} // namespace boost - diff --git a/include/boost/mpl/aux_/preprocessed/gcc/meta_fun.hpp b/include/boost/mpl/aux_/preprocessed/plain/quote.hpp similarity index 67% rename from include/boost/mpl/aux_/preprocessed/gcc/meta_fun.hpp rename to include/boost/mpl/aux_/preprocessed/plain/quote.hpp index befe244..0a8e644 100644 --- a/include/boost/mpl/aux_/preprocessed/gcc/meta_fun.hpp +++ b/include/boost/mpl/aux_/preprocessed/plain/quote.hpp @@ -1,16 +1,31 @@ -// preprocessed version of 'boost/mpl/meta_fun.hpp' header +// preprocessed version of 'boost/mpl/quote.hpp' header // see the original for copyright information namespace boost { namespace mpl { +template< typename T, bool has_type_ = aux::has_type::value > +struct quote_impl + + : T +{ +}; + +template< typename T > +struct quote_impl< T,false > +{ + typedef T type; +}; + template< template< typename P1 > class F > -struct meta_fun1 +struct quote1 { template< typename U1 > struct apply - : F + + : quote_impl< F > + { }; }; @@ -18,10 +33,12 @@ struct meta_fun1 template< template< typename P1, typename P2 > class F > -struct meta_fun2 +struct quote2 { template< typename U1, typename U2 > struct apply - : F< U1,U2 > + + : quote_impl< F > + { }; }; @@ -29,10 +46,12 @@ struct meta_fun2 template< template< typename P1, typename P2, typename P3 > class F > -struct meta_fun3 +struct quote3 { template< typename U1, typename U2, typename U3 > struct apply - : F< U1,U2,U3 > + + : quote_impl< F > + { }; }; @@ -40,13 +59,15 @@ struct meta_fun3 template< template< typename P1, typename P2, typename P3, typename P4 > class F > -struct meta_fun4 +struct quote4 { template< typename U1, typename U2, typename U3, typename U4 > struct apply - : F< U1,U2,U3,U4 > + + : quote_impl< F > + { }; }; @@ -58,14 +79,16 @@ template< > class F > -struct meta_fun5 +struct quote5 { template< typename U1, typename U2, typename U3, typename U4 , typename U5 > struct apply - : F< U1,U2,U3,U4,U5 > + + : quote_impl< F > + { }; }; diff --git a/include/boost/mpl/meta_fun.hpp b/include/boost/mpl/quote.hpp similarity index 54% rename from include/boost/mpl/meta_fun.hpp rename to include/boost/mpl/quote.hpp index a3beb8e..a23093e 100644 --- a/include/boost/mpl/meta_fun.hpp +++ b/include/boost/mpl/quote.hpp @@ -1,5 +1,5 @@ //----------------------------------------------------------------------------- -// boost mpl/meta_fun.hpp header file +// boost mpl/quote.hpp header file // See http://www.boost.org for updates, documentation, and revision history. //----------------------------------------------------------------------------- // @@ -18,15 +18,19 @@ ///// header body -#ifndef BOOST_MPL_META_FUN_HPP_INCLUDED -#define BOOST_MPL_META_FUN_HPP_INCLUDED +#ifndef BOOST_MPL_QUOTE_HPP_INCLUDED +#define BOOST_MPL_QUOTE_HPP_INCLUDED + +#if !defined(BOOST_MPL_PREPROCESSING_MODE) +# include "boost/mpl/aux_/has_type.hpp" +#endif #include "boost/mpl/aux_/config/use_preprocessed.hpp" -#if defined(BOOST_MPL_USE_PREPROCESSED_HEADERS) && \ - !defined(BOOST_MPL_PREPROCESSING_MODE) +#if defined(BOOST_MPL_USE_PREPROCESSED_HEADERS) \ + && !defined(BOOST_MPL_PREPROCESSING_MODE) -# define BOOST_MPL_PREPROCESSED_HEADER meta_fun.hpp +# define BOOST_MPL_PREPROCESSED_HEADER quote.hpp # include "boost/mpl/aux_/include_preprocessed.hpp" #else @@ -34,6 +38,7 @@ # include "boost/mpl/limits/arity.hpp" # include "boost/mpl/aux_/preprocessor/params.hpp" # include "boost/mpl/aux_/config/ttp.hpp" +# include "boost/mpl/aux_/config/ctps.hpp" # include "boost/preprocessor/iterate.hpp" # include "boost/preprocessor/cat.hpp" @@ -43,8 +48,47 @@ namespace boost { namespace mpl { +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) + +template< typename T, bool has_type_ = aux::has_type::value > +struct quote_impl +#if !defined(__BORLANDC__) && (__BORLANDC__ <= 0x561 || !defined(BOOST_STRICT_CONFIG)) + : T +{ +#else +{ + typedef typename T::type type; +#endif +}; + +template< typename T > +struct quote_impl +{ + typedef T type; +}; + +#else + +template< bool > struct quote_impl +{ + template< typename T > struct result_ + : T + { + }; +}; + +template<> struct quote_impl +{ + template< typename T > struct result_ + { + typedef T type; + }; +}; + +#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + #define BOOST_PP_ITERATION_PARAMS_1 \ - (3,(1, BOOST_MPL_METAFUNCTION_MAX_ARITY, "boost/mpl/meta_fun.hpp")) + (3,(1, BOOST_MPL_METAFUNCTION_MAX_ARITY, "boost/mpl/quote.hpp")) #include BOOST_PP_ITERATE() } // namespace mpl @@ -53,7 +97,7 @@ namespace mpl { #endif // BOOST_NO_TEMPLATE_TEMPLATE_PARAMETERS #endif // BOOST_MPL_USE_PREPROCESSED_HEADERS -#endif // BOOST_MPL_META_FUN_HPP_INCLUDED +#endif // BOOST_MPL_QUOTE_HPP_INCLUDED ///// iteration @@ -63,10 +107,15 @@ namespace mpl { template< template< BOOST_MPL_PP_PARAMS(i, typename P) > class F > -struct BOOST_PP_CAT(meta_fun,i) +struct BOOST_PP_CAT(quote,i) { template< BOOST_MPL_PP_PARAMS(i, typename U) > struct apply - : F< BOOST_MPL_PP_PARAMS(i, U) > +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) + : quote_impl< F< BOOST_MPL_PP_PARAMS(i, U) > > +#else + : quote_impl< aux::has_type< F< BOOST_MPL_PP_PARAMS(i, U) > >::value > + ::template result_< F< BOOST_MPL_PP_PARAMS(i, U) > > +#endif { }; }; diff --git a/include/boost/mpl/v2_1/type_traits.hpp b/include/boost/mpl/v2_1/type_traits.hpp index 37d1451..3132265 100644 --- a/include/boost/mpl/v2_1/type_traits.hpp +++ b/include/boost/mpl/v2_1/type_traits.hpp @@ -17,14 +17,14 @@ #ifndef BOOST_MPL_V2_1_TYPE_TRAITS_HPP_INCLUDED #define BOOST_MPL_V2_1_TYPE_TRAITS_HPP_INCLUDED -#include "boost/mpl/meta_fun.hpp" +#include "boost/mpl/quote.hpp" #include "boost/type_traits/is_same.hpp" #include "boost/type_traits/is_float.hpp" namespace boost { namespace mpl { namespace v2_1 { -struct is_float : mpl::meta_fun1 {}; -struct is_same : mpl::meta_fun2 {}; +struct is_float : mpl::quote1 {}; +struct is_same : mpl::quote2 {}; }}} // namespace boost::mpl::v2_1 diff --git a/preprocessed/src/meta_fun.cpp b/preprocessed/src/quote.cpp similarity index 52% rename from preprocessed/src/meta_fun.cpp rename to preprocessed/src/quote.cpp index 646a153..31a12de 100644 --- a/preprocessed/src/meta_fun.cpp +++ b/preprocessed/src/quote.cpp @@ -1,2 +1,2 @@ #define BOOST_MPL_PREPROCESSING_MODE -#include "boost/mpl/meta_fun.hpp" +#include "boost/mpl/quote.hpp" diff --git a/test/Jamfile b/test/Jamfile index bd55466..b1cf376 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -31,6 +31,7 @@ compile erase_range.cpp ; compile filter_view.cpp ; compile find.cpp ; compile find_if.cpp ; +compile fold.cpp ; unit-test for_each : for_each.cpp : $(BOOST_ROOT) ; compile front.cpp ; compile identity.cpp ; @@ -48,10 +49,10 @@ compile list.cpp ; compile list_c.cpp ; compile logical.cpp ; compile lower_bound.cpp ; -compile meta_fun.cpp ; compile next.cpp ; compile pop_front.cpp ; compile push_front.cpp ; +compile quote.cpp ; compile range_c.cpp ; compile replace.cpp ; compile replace_if.cpp ; diff --git a/test/count_if.cpp b/test/count_if.cpp index b864d60..eb0294c 100644 --- a/test/count_if.cpp +++ b/test/count_if.cpp @@ -33,7 +33,7 @@ int main() BOOST_STATIC_ASSERT((mpl::count_if< types, boost::is_float<_> >::type::value == 1)); BOOST_STATIC_ASSERT((mpl::count_if< types, boost::is_same<_,char&> >::type::value == 2)); - BOOST_STATIC_ASSERT((mpl::count_if< types, boost::is_same<_,void> >::type::value == 0)); + BOOST_STATIC_ASSERT((mpl::count_if< types, boost::is_same<_,void*> >::type::value == 0)); BOOST_STATIC_ASSERT((mpl::count_if< values, mpl::lt<5> >::type::value == 4)); BOOST_STATIC_ASSERT((mpl::count_if< values, mpl::eq<0> >::type::value == 2)); diff --git a/test/quote.cpp b/test/quote.cpp new file mode 100644 index 0000000..3cd99d9 --- /dev/null +++ b/test/quote.cpp @@ -0,0 +1,46 @@ +//----------------------------------------------------------------------------- +// boost mpl/test/quote.cpp source file +// See http://www.boost.org for updates, documentation, and revision history. +//----------------------------------------------------------------------------- +// +// Copyright (c) 2000-02 +// Aleksey Gurtovoy +// +// Permission to use, copy, modify, distribute and sell this software +// and its documentation for any purpose is hereby granted without fee, +// provided that the above copyright notice appears in all copies and +// that both the copyright notice and this permission notice appear in +// supporting documentation. No representations are made about the +// suitability of this software for any purpose. It is provided "as is" +// without express or implied warranty. + +#include "boost/mpl/quote.hpp" +#include "boost/mpl/apply.hpp" +#include "boost/type_traits/is_same.hpp" +#include "boost/static_assert.hpp" + +using namespace boost::mpl; + +template< typename T > struct f1 +{ + typedef T type; +}; + +template< + typename T1, typename T2, typename T3, typename T4, typename T5 + > +struct f5 +{ + // no 'type' member! +}; + +int main() +{ + typedef apply1< quote1,int >::type t1; + typedef apply5< quote5,char,short,int,long,float >::type t5; + + BOOST_STATIC_ASSERT((boost::is_same< t1, int >::value)); + BOOST_STATIC_ASSERT((boost::is_same< t5, f5 >::value)); + + return 0; +}