diff --git a/example/lambda2.cpp b/example/lambda2.cpp new file mode 100644 index 0000000..99e4385 --- /dev/null +++ b/example/lambda2.cpp @@ -0,0 +1,66 @@ +//----------------------------------------------------------------------------- +// boost mpl/example/lambda2.cpp source file +// See http://www.boost.org for updates, documentation, and revision history. +//----------------------------------------------------------------------------- +// +// Copyright (c) 2002 +// 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/v2_1.hpp" + +#include "boost/mpl/logical/and.hpp" +#include "boost/mpl/comparison/less.hpp" +#include "boost/mpl/comparison/equal_to.hpp" +#include "boost/mpl/arithmetic/multiplies.hpp" +#include "boost/mpl/prior.hpp" +#include "boost/mpl/find_if.hpp" +#include "boost/mpl/count_if.hpp" +#include "boost/mpl/filter_view.hpp" +#include "boost/mpl/sizeof.hpp" + +#include "boost/static_assert.hpp" + +namespace mpl = boost::mpl; +using namespace mpl::placeholder; +using namespace mpl::v2_1; + + +typedef EVAL(apply_(lambda(is_same(_,_)), int, int)) r; + +BOOST_STATIC_ASSERT(r::value); + +typedef eval< + count_if( + list(int,char,long,int) + , lambda(is_same(_,int)) + ) + >::type r2; + +BOOST_STATIC_ASSERT(r2::value == 2); + +typedef eval< + find_if( + filter_view(list(int,char,long,double), lambda(is_float(_))) + , lambda( and_( is_same(_,int), less(sizeof_(_),sizeof_(double)) ) ) + ) + >::type t2; + + +METAFUNCTION(factorial, (N) + , if_( equal_to( N, int_<0> ) + , int_<1> + , multiplies( N, factorial( prior(N) ) ) + ) + ) + +typedef EVAL(factorial(int_<1>)) fact; + +//BOOST_STATIC_ASSERT(fact::value == 1); diff --git a/include/boost/mpl/O1_size.hpp b/include/boost/mpl/O1_size.hpp index de9dd30..e6634a7 100644 --- a/include/boost/mpl/O1_size.hpp +++ b/include/boost/mpl/O1_size.hpp @@ -26,7 +26,9 @@ namespace boost { namespace mpl { // returns sequence size if it's an O(1) operation; otherwise returns -1 -template< typename Sequence > +template< + typename BOOST_MPL_AUX_VOID_SPEC_PARAM(Sequence) + > struct O1_size : O1_size_traits< typename BOOST_MPL_AUX_SEQUENCE_TAG(Sequence) > ::template algorithm< Sequence > diff --git a/include/boost/mpl/aux_/filter_iter.hpp b/include/boost/mpl/aux_/filter_iter.hpp new file mode 100644 index 0000000..686a130 --- /dev/null +++ b/include/boost/mpl/aux_/filter_iter.hpp @@ -0,0 +1,147 @@ +//----------------------------------------------------------------------------- +// boost mpl/aux_/filter_iter.hpp header 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. + +#ifndef BOOST_MPL_AUX_FILTER_ITER_HPP_INCLUDED +#define BOOST_MPL_AUX_FILTER_ITER_HPP_INCLUDED + +#include "boost/mpl/find_if.hpp" +#include "boost/mpl/iterator_range.hpp" +#include "boost/mpl/apply.hpp" +#include "boost/mpl/aux_/lambda_spec.hpp" +#include "boost/mpl/aux_/config/ctps.hpp" +#include "boost/type_traits/is_same.hpp" + +namespace boost { +namespace mpl { +namespace aux { + +template< + typename Iterator + , typename LastIterator + , typename Predicate + > +struct filter_iter; + +template< + typename Iterator + , typename LastIterator + , typename Predicate + > +struct next_filter_iter +{ + private: + typedef typename find_if< + iterator_range + , Predicate + >::type base_iter_; + + public: + typedef filter_iter type; +}; + +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) + +template< + typename Iterator + , typename LastIterator + , typename Predicate + > +struct filter_iter +{ + typedef Iterator base; + typedef typename base::category category; + typedef typename aux::next_filter_iter< + typename base::next + , LastIterator + , Predicate + >::type next; + + typedef typename base::type type; +}; + +template< + typename LastIterator + , typename Predicate + > +struct filter_iter< LastIterator,LastIterator,Predicate > +{ + typedef LastIterator base; + typedef typename base::category category; +}; + +#else + +template< bool > +struct filter_iter_impl +{ + template< + typename Iterator + , typename LastIterator + , typename Predicate + > + struct result_ + { + typedef Iterator base; + // agurt, 14/oct/02: have to use 'Iterator' instead of 'base' below + // to prevent 'base' and 'mpl::base' conflict on MSVC 6.0 + typedef typename Iterator::category category; + typedef typename next_filter_iter< + typename Iterator::next + , LastIterator + , Predicate + >::type next; + + typedef typename base::type type; + }; +}; + +template<> +struct filter_iter_impl< true > +{ + template< + typename Iterator + , typename LastIterator + , typename Predicate + > + struct result_ + { + typedef Iterator base; + typedef typename Iterator::category category; + }; +}; + +template< + typename Iterator + , typename LastIterator + , typename Predicate + > +struct filter_iter + : filter_iter_impl< + ::boost::is_same::value + >::template result_< Iterator,LastIterator,Predicate > +{ +}; + +#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + +} // namespace aux + +BOOST_MPL_AUX_PASS_THROUGH_LAMBDA_SPEC(3, aux::filter_iter) + +} // namespace mpl +} // namespace boost + +#endif // BOOST_MPL_AUX_FILTER_ITER_HPP_INCLUDED diff --git a/include/boost/mpl/aux_/void_spec.hpp b/include/boost/mpl/aux_/void_spec.hpp index 52200fe..34cf8bd 100644 --- a/include/boost/mpl/aux_/void_spec.hpp +++ b/include/boost/mpl/aux_/void_spec.hpp @@ -26,6 +26,7 @@ #include "boost/mpl/aux_/template_arity_fwd.hpp" #include "boost/mpl/aux_/lambda_arity_param.hpp" #include "boost/mpl/aux_/config/dtp.hpp" +#include "boost/mpl/aux_/config/ntp.hpp" #include "boost/mpl/aux_/config/ttp.hpp" #include "boost/mpl/aux_/config/lambda.hpp" #include "boost/mpl/aux_/config/overload_resolution.hpp" @@ -39,7 +40,7 @@ #if defined(BOOST_BROKEN_DEFAULT_TEMPLATE_PARAMETERS_IN_NESTED_TEMPLATES) # define BOOST_MPL_AUX_VOID_SPEC_ARITY(i, name) \ namespace aux { \ -template< int N > \ +template< BOOST_MPL_AUX_NTP_DECL(int, N) > \ struct arity< \ name< BOOST_MPL_AUX_VOID_SPEC_PARAMS(i) > \ , N \ @@ -68,6 +69,10 @@ struct name< BOOST_MPL_AUX_VOID_SPEC_PARAMS(i) > \ { \ }; \ }; \ +\ +namespace v2_1 { \ +struct name : ::boost::mpl::name<> {}; \ +} \ /**/ #if defined(BOOST_MPL_NO_FULL_LAMBDA_SUPPORT) diff --git a/include/boost/mpl/filter_view.hpp b/include/boost/mpl/filter_view.hpp index ff1edbe..b8f1c81 100644 --- a/include/boost/mpl/filter_view.hpp +++ b/include/boost/mpl/filter_view.hpp @@ -17,77 +17,32 @@ #ifndef BOOST_MPL_FILTER_VIEW_HPP_INCLUDED #define BOOST_MPL_FILTER_VIEW_HPP_INCLUDED -#include "boost/mpl/find_if.hpp" -#include "boost/mpl/iterator_range.hpp" #include "boost/mpl/begin_end.hpp" #include "boost/mpl/lambda.hpp" -#include "boost/mpl/apply.hpp" +#include "boost/mpl/aux_/filter_iter.hpp" #include "boost/mpl/aux_/void_spec.hpp" -#include "boost/mpl/aux_/lambda_spec.hpp" namespace boost { namespace mpl { -// forward declaration for next_filter_iter -template< typename Iterator, typename LastIterator, typename F > -struct filter_iter; - -namespace aux { -template< - typename Iterator - , typename LastIterator - , typename F - > -struct next_filter_iter -{ - private: - typedef typename find_if< - iterator_range - , F - >::type base_iter_; - - public: - typedef filter_iter type; -}; -} // namespace aux - -template< - typename Iterator - , typename LastIterator - , typename F - > -struct filter_iter -{ - typedef Iterator base; - typedef typename base::category category; - typedef typename aux::next_filter_iter< - typename base::next - , LastIterator - , F - >::type next; - - typedef typename base::type type; -}; - template< typename BOOST_MPL_AUX_VOID_SPEC_PARAM(Sequence) - , typename BOOST_MPL_AUX_VOID_SPEC_PARAM(F) + , typename BOOST_MPL_AUX_VOID_SPEC_PARAM(Predicate) > struct filter_view { private: - typedef typename lambda::type f_; + typedef typename lambda::type pred_; typedef typename begin::type first_; typedef typename end::type last_; public: struct tag; typedef filter_view type; - typedef typename aux::next_filter_iter< first_,last_,f_ >::type begin; - typedef filter_iter< last_,last_,f_ > end; + typedef typename aux::next_filter_iter< first_,last_,pred_ >::type begin; + typedef aux::filter_iter< last_,last_,pred_ > end; }; -BOOST_MPL_AUX_PASS_THROUGH_LAMBDA_SPEC(3,filter_iter) BOOST_MPL_AUX_VOID_SPEC(2, filter_view) } // namespace mpl diff --git a/include/boost/mpl/logical/and.hpp b/include/boost/mpl/logical/and.hpp index df50b64..8661ae2 100644 --- a/include/boost/mpl/logical/and.hpp +++ b/include/boost/mpl/logical/and.hpp @@ -121,6 +121,10 @@ struct logical_and BOOST_MPL_AUX_VOID_SPEC_EXT(2,5,logical_and) +namespace v2_1 { +struct and_ : mpl::logical_and<> {}; +} + } // namespace mpl } // namespace boost diff --git a/include/boost/mpl/logical/not.hpp b/include/boost/mpl/logical/not.hpp index e5d00aa..a8a9630 100644 --- a/include/boost/mpl/logical/not.hpp +++ b/include/boost/mpl/logical/not.hpp @@ -49,6 +49,10 @@ struct logical_not BOOST_MPL_AUX_VOID_SPEC(1,logical_not) +namespace v2_1 { +struct not_ : mpl::logical_not<> {}; +} + } // namespace mpl } // namespace boost diff --git a/include/boost/mpl/logical/or.hpp b/include/boost/mpl/logical/or.hpp index 0dbc7f6..3423473 100644 --- a/include/boost/mpl/logical/or.hpp +++ b/include/boost/mpl/logical/or.hpp @@ -121,6 +121,10 @@ struct logical_or BOOST_MPL_AUX_VOID_SPEC_EXT(2,5,logical_or) +namespace v2_1 { +struct or_ : mpl::logical_or<> {}; +} + } // namespace mpl } // namespace boost diff --git a/include/boost/mpl/v2_1.hpp b/include/boost/mpl/v2_1.hpp new file mode 100644 index 0000000..1426c7c --- /dev/null +++ b/include/boost/mpl/v2_1.hpp @@ -0,0 +1,29 @@ +//----------------------------------------------------------------------------- +// boost mpl/v2_1.hpp header file +// See http://www.boost.org for updates, documentation, and revision history. +//----------------------------------------------------------------------------- +// +// Copyright (c) 2001-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. + +#ifndef BOOST_MPL_V2_1_HPP_INCLUDED +#define BOOST_MPL_V2_1_HPP_INCLUDED + +#include "boost/mpl/v2_1/apply.hpp" +#include "boost/mpl/v2_1/eval.hpp" +#include "boost/mpl/v2_1/expr.hpp" +#include "boost/mpl/v2_1/int.hpp" +#include "boost/mpl/v2_1/lambda.hpp" +#include "boost/mpl/v2_1/list.hpp" +#include "boost/mpl/v2_1/metafunction.hpp" +#include "boost/mpl/v2_1/type_traits.hpp" + +#endif // BOOST_MPL_V2_1_HPP_INCLUDED diff --git a/include/boost/mpl/v2_1/apply.hpp b/include/boost/mpl/v2_1/apply.hpp new file mode 100644 index 0000000..464157d --- /dev/null +++ b/include/boost/mpl/v2_1/apply.hpp @@ -0,0 +1,62 @@ +//----------------------------------------------------------------------------- +// boost mpl/v2_1/apply.hpp header 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. + +#ifndef BOOST_MPL_V2_1_APPLY_HPP_INCLUDED +#define BOOST_MPL_V2_1_APPLY_HPP_INCLUDED + +#include "boost/mpl/apply.hpp" +#include "boost/mpl/limits/arity.hpp" +#include "boost/mpl/aux_/preprocessor/params.hpp" +#include "boost/mpl/aux_/preprocessor/default_params.hpp" + +namespace boost { namespace mpl { namespace v2_1 { + +# define AUX_APPLY_PARAMS(param) \ + BOOST_MPL_PP_PARAMS( \ + BOOST_MPL_METAFUNCTION_MAX_ARITY \ + , param \ + ) \ + /**/ + +# define AUX_APPLY_DEFAULT_PARAMS(param, value) \ + BOOST_MPL_PP_DEFAULT_PARAMS( \ + BOOST_MPL_METAFUNCTION_MAX_ARITY \ + , param \ + , value \ + ) \ + /**/ + + +struct apply_impl +{ + template< + typename F + , AUX_APPLY_DEFAULT_PARAMS(typename T, mpl::void_) + > + struct apply + : mpl::apply + { + }; +}; + +struct apply_ : apply_impl {}; + +# undef AUX_APPLY_DEFAULT_PARAMS +# undef AUX_APPLY_PARAMS + +}}} // namespace boost::mpl::v2_1 + +#endif // BOOST_MPL_V2_1_APPLY_HPP_INCLUDED diff --git a/include/boost/mpl/v2_1/eval.hpp b/include/boost/mpl/v2_1/eval.hpp new file mode 100644 index 0000000..8214b4e --- /dev/null +++ b/include/boost/mpl/v2_1/eval.hpp @@ -0,0 +1,37 @@ +//----------------------------------------------------------------------------- +// boost mpl/v2_1/eval.hpp header 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. + +#ifndef BOOST_MPL_V2_1_EVAL_HPP_INCLUDED +#define BOOST_MPL_V2_1_EVAL_HPP_INCLUDED + +#include "boost/mpl/v2_1/expr.hpp" +#include "boost/mpl/v2_1/metafunction_base.hpp" + +namespace boost { namespace mpl { namespace v2_1 { + +template< + typename F + > +struct eval + : expr::type::template apply<> +{ +}; + +}}} // namespace boost::mpl::v2_1 + +#define EVAL(expr) eval::type + +#endif // BOOST_MPL_V2_1_EVAL_HPP_INCLUDED diff --git a/include/boost/mpl/v2_1/expr.hpp b/include/boost/mpl/v2_1/expr.hpp new file mode 100644 index 0000000..77a9d02 --- /dev/null +++ b/include/boost/mpl/v2_1/expr.hpp @@ -0,0 +1,108 @@ +//----------------------------------------------------------------------------- +// boost mpl/v2_1/expr.hpp header file +// See http://www.boost.org for updates, documentation, and revision history. +//----------------------------------------------------------------------------- +// +// Copyright (c) 2001-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. + +#if !defined(BOOST_PP_IS_ITERATING) + +///// header body + +#ifndef BOOST_MPL_EXPR_V2_1_HPP_INCLUDED +#define BOOST_MPL_EXPR_V2_1_HPP_INCLUDED + +#if !defined(BOOST_MPL_PREPROCESSING_MODE) +# include "boost/mpl/v2_1/expr_fwd.hpp" +# include "boost/mpl/bind.hpp" +#endif + +#if 0//defined(BOOST_MPL_USE_PREPROCESSED_HEADERS) && + //!defined(BOOST_MPL_PREPROCESSING_MODE) + +# define BOOST_MPL_PREPROCESSED_HEADER expr.hpp +# include "boost/mpl/aux_/include_preprocessed.hpp" + +#else + +# include "boost/mpl/limits/arity.hpp" +# include "boost/mpl/aux_/preprocessor/params.hpp" +# include "boost/mpl/aux_/preprocessor/repeat.hpp" +# include "boost/preprocessor/iterate.hpp" +# include "boost/preprocessor/comma_if.hpp" +# include "boost/preprocessor/inc.hpp" +# include "boost/preprocessor/cat.hpp" + +namespace boost { namespace mpl { namespace v2_1 { + +# define AUX_EXPR_PARAMS(n, param) \ + BOOST_MPL_PP_PARAMS(n, param) \ + /**/ + +# define AUX_EXPR_SPEC_PARAMS(n, F, param) \ + F BOOST_PP_COMMA_IF(n) \ + BOOST_MPL_PP_PARAMS(n, param) \ + /**/ + + +template< typename T > struct expr +{ + typedef T type; +}; + + +#define BOOST_PP_ITERATION_PARAMS_1 \ + (3,(0, BOOST_MPL_METAFUNCTION_MAX_ARITY, "boost/mpl/v2_1/expr.hpp")) +#include BOOST_PP_ITERATE() + + +# undef AUX_EXPR_SPEC_PARAMS +# undef AUX_EXPR_PARAMS + +}}} // namespace boost::mpl::v2_1 + +#endif // BOOST_MPL_USE_PREPROCESSED_HEADERS +#endif // BOOST_MPL_EXPR_V2_1_HPP_INCLUDED + +///// iteration, depth == 1 + +#elif BOOST_PP_ITERATION_DEPTH() == 1 +#define n BOOST_PP_FRAME_ITERATION(1) + +template< + AUX_EXPR_SPEC_PARAMS(n, typename F, typename T) + > +struct expr< F (*)(AUX_EXPR_PARAMS(n, T)) > +{ +# define AUX_EXPR_INVOCATION(unused, n, T) \ + BOOST_PP_COMMA_IF(n) \ + typename expr< BOOST_PP_CAT(T, BOOST_PP_INC(n)) >::type \ + /**/ + + typedef BOOST_PP_CAT(bind,n)< + F + BOOST_PP_COMMA_IF(n) BOOST_MPL_PP_REPEAT(n, AUX_EXPR_INVOCATION, T) + > type; + +# undef AUX_EXPR_INVOCATION +}; + +template< + AUX_EXPR_SPEC_PARAMS(n, typename F, typename T) + > +struct expr< F (AUX_EXPR_PARAMS(n, T)) > + : expr< F (*)(AUX_EXPR_PARAMS(n, T)) > +{ +}; + +#undef n +#endif // BOOST_PP_IS_ITERATING diff --git a/include/boost/mpl/v2_1/expr_fwd.hpp b/include/boost/mpl/v2_1/expr_fwd.hpp new file mode 100644 index 0000000..5371c32 --- /dev/null +++ b/include/boost/mpl/v2_1/expr_fwd.hpp @@ -0,0 +1,26 @@ +//----------------------------------------------------------------------------- +// boost mpl/v2_1/expr_fwd.hpp header file +// See http://www.boost.org for updates, documentation, and revision history. +//----------------------------------------------------------------------------- +// +// Copyright (c) 2001-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. + +#ifndef BOOST_MPL_EXPR_V2_1_FWD_HPP_INCLUDED +#define BOOST_MPL_EXPR_V2_1_FWD_HPP_INCLUDED + +namespace boost { namespace mpl { namespace v2_1 { + +template< typename T > struct expr; + +}}} + +#endif // BOOST_MPL_EXPR_V2_1_FWD_HPP_INCLUDED diff --git a/include/boost/mpl/v2_1/int.hpp b/include/boost/mpl/v2_1/int.hpp new file mode 100644 index 0000000..6ae894c --- /dev/null +++ b/include/boost/mpl/v2_1/int.hpp @@ -0,0 +1,28 @@ +//----------------------------------------------------------------------------- +// boost mpl/v2_1/int.hpp header 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. + +#ifndef BOOST_MPL_V2_1_INT_HPP_INCLUDED +#define BOOST_MPL_V2_1_INT_HPP_INCLUDED + +#include "boost/mpl/int_c.hpp" + +namespace boost { namespace mpl { namespace v2_1 { + +template< int N > struct int_ : mpl::int_c {}; + +}}} // namespace boost::mpl::v2_1 + +#endif // BOOST_MPL_V2_1_INT_HPP_INCLUDED diff --git a/include/boost/mpl/v2_1/lambda.hpp b/include/boost/mpl/v2_1/lambda.hpp new file mode 100644 index 0000000..34d6991 --- /dev/null +++ b/include/boost/mpl/v2_1/lambda.hpp @@ -0,0 +1,39 @@ +//----------------------------------------------------------------------------- +// boost mpl/v2_1/lambda.hpp header file +// See http://www.boost.org for updates, documentation, and revision history. +//----------------------------------------------------------------------------- +// +// Copyright (c) 2001-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. + +#ifndef BOOST_MPL_V2_1_LAMBDA_HPP_INCLUDED +#define BOOST_MPL_V2_1_LAMBDA_HPP_INCLUDED + +#include "boost/mpl/v2_1/expr.hpp" +#include "boost/mpl/protect.hpp" + +namespace boost { namespace mpl { namespace v2_1 { + +struct lambda; + +template< + typename T + > +struct expr< lambda (*)(T) > +{ + typedef protect< + typename expr::type + > type; +}; + +}}} // namespace boost::mpl::v2_1 + +#endif // BOOST_MPL_V2_1_LAMBDA_HPP_INCLUDED diff --git a/include/boost/mpl/v2_1/list.hpp b/include/boost/mpl/v2_1/list.hpp new file mode 100644 index 0000000..ac1e1ee --- /dev/null +++ b/include/boost/mpl/v2_1/list.hpp @@ -0,0 +1,58 @@ +//----------------------------------------------------------------------------- +// boost mpl/v2_1/list.hpp header 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. + +#ifndef BOOST_MPL_V2_1_LIST_HPP_INCLUDED +#define BOOST_MPL_V2_1_LIST_HPP_INCLUDED + +#include "boost/mpl/list.hpp" +#include "boost/mpl/limits/list.hpp" +#include "boost/preprocessor/enum_params_with_a_default.hpp" +#include "boost/preprocessor/enum_params.hpp" + +namespace boost { namespace mpl { namespace v2_1 { + +# define AUX_LIST_PARAMS(param) \ + BOOST_PP_ENUM_PARAMS( \ + BOOST_MPL_LIMIT_LIST_SIZE \ + , param \ + ) \ + /**/ + +# define AUX_LIST_DEFAULT_PARAMS(param, value) \ + BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT( \ + BOOST_MPL_LIMIT_LIST_SIZE \ + , param \ + , value \ + ) \ + /**/ + +struct list +{ + template< + AUX_LIST_DEFAULT_PARAMS(typename T, void_) + > + struct apply + : mpl::list< AUX_LIST_PARAMS(T) > + { + }; +}; + +# undef AUX_LIST_DEFAULT_PARAMS +# undef AUX_LIST_PARAMS + +}}} // namespace boost::mpl::v2_1 + +#endif // BOOST_MPL_V2_1_LIST_HPP_INCLUDED diff --git a/include/boost/mpl/v2_1/metafunction.hpp b/include/boost/mpl/v2_1/metafunction.hpp new file mode 100644 index 0000000..09c81b8 --- /dev/null +++ b/include/boost/mpl/v2_1/metafunction.hpp @@ -0,0 +1,47 @@ +//----------------------------------------------------------------------------- +// boost mpl/v2_1/metafunction.hpp header 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. + +#ifndef BOOST_MPL_V2_1_METAFUNCTION_HPP_INCLUDED +#define BOOST_MPL_V2_1_METAFUNCTION_HPP_INCLUDED + +#include "boost/mpl/v2_1/expr.hpp" +#include "boost/mpl/v2_1/metafunction_base.hpp" +#include "boost/preprocessor/comma_if.hpp" +#include "boost/preprocessor/identity.hpp" +#include "boost/preprocessor/seq/for_each_i.hpp" + +#define BOOST_MPL_AUX_METAFUNCTION_PARAM(unused, prefix, n, param) \ + BOOST_PP_COMMA_IF(n) prefix() param \ +/**/ + +#define METAFUNCTION(name, params, body) \ +struct name : metafunction_base \ +{ \ + template< \ + BOOST_PP_SEQ_FOR_EACH_I( \ + BOOST_MPL_AUX_METAFUNCTION_PARAM \ + , BOOST_PP_IDENTITY(typename) \ + , params \ + ) \ + > \ + struct apply \ + : boost::mpl::v2_1::expr< body > \ + { \ + }; \ +}; \ +/**/ + +#endif // BOOST_MPL_V2_1_METAFUNCTION_HPP_INCLUDED diff --git a/include/boost/mpl/v2_1/metafunction_base.hpp b/include/boost/mpl/v2_1/metafunction_base.hpp new file mode 100644 index 0000000..d594fe9 --- /dev/null +++ b/include/boost/mpl/v2_1/metafunction_base.hpp @@ -0,0 +1,26 @@ +//----------------------------------------------------------------------------- +// boost mpl/v2_1/metafunction_base.hpp header 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. + +#ifndef BOOST_MPL_V2_1_METAFUNCTION_BASE_HPP_INCLUDED +#define BOOST_MPL_V2_1_METAFUNCTION_BASE_HPP_INCLUDED + +namespace boost { namespace mpl { namespace v2_1 { + +struct metafunction_base {}; + +}}} // namespace boost::mpl::v2_1 + +#endif // BOOST_MPL_V2_1_METAFUNCTION_BASE_HPP_INCLUDED diff --git a/include/boost/mpl/v2_1/type_traits.hpp b/include/boost/mpl/v2_1/type_traits.hpp new file mode 100644 index 0000000..37d1451 --- /dev/null +++ b/include/boost/mpl/v2_1/type_traits.hpp @@ -0,0 +1,31 @@ +//----------------------------------------------------------------------------- +// boost mpl/v2_1/type_traits.hpp header 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. + +#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/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 {}; + +}}} // namespace boost::mpl::v2_1 + +#endif // BOOST_MPL_V2_1_TYPE_TRAITS_HPP_INCLUDED