v2_1 lambda initial checkin

[SVN r16310]
This commit is contained in:
Aleksey Gurtovoy
2002-11-18 10:33:17 +00:00
parent 71629bee73
commit e24cd44527
19 changed files with 730 additions and 52 deletions

66
example/lambda2.cpp Normal file
View File

@@ -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);

View File

@@ -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 >

View File

@@ -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<Iterator,LastIterator>
, Predicate
>::type base_iter_;
public:
typedef filter_iter<base_iter_,LastIterator,Predicate> 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<Iterator,LastIterator>::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

View File

@@ -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)

View File

@@ -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<Iterator,LastIterator>
, F
>::type base_iter_;
public:
typedef filter_iter<base_iter_,LastIterator,F> 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<F>::type f_;
typedef typename lambda<Predicate>::type pred_;
typedef typename begin<Sequence>::type first_;
typedef typename end<Sequence>::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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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<F, AUX_APPLY_PARAMS(T)>
{
};
};
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

View File

@@ -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<F>::type::template apply<>
{
};
}}} // namespace boost::mpl::v2_1
#define EVAL(expr) eval<expr>::type
#endif // BOOST_MPL_V2_1_EVAL_HPP_INCLUDED

View File

@@ -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

View File

@@ -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

View File

@@ -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<N> {};
}}} // namespace boost::mpl::v2_1
#endif // BOOST_MPL_V2_1_INT_HPP_INCLUDED

View File

@@ -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<T>::type
> type;
};
}}} // namespace boost::mpl::v2_1
#endif // BOOST_MPL_V2_1_LAMBDA_HPP_INCLUDED

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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<boost::is_float> {};
struct is_same : mpl::meta_fun2<boost::is_same> {};
}}} // namespace boost::mpl::v2_1
#endif // BOOST_MPL_V2_1_TYPE_TRAITS_HPP_INCLUDED