more pre-preprocessing work
[SVN r71742]
This commit is contained in:
parent
6ec51640ec
commit
45c5319b29
@ -1,223 +1,165 @@
|
||||
#ifndef BOOST_PP_IS_ITERATING
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file args.hpp
|
||||
/// Contains definition of \c term\<\>, \c list1\<\>, \c list2\<\>, ...
|
||||
/// class templates.
|
||||
//
|
||||
// Copyright 2008 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file args.hpp
|
||||
/// Contains definition of \c term\<\>, \c list1\<\>, \c list2\<\>, ...
|
||||
/// class templates.
|
||||
//
|
||||
// Copyright 2008 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_PROTO_ARGS_HPP_EAN_04_01_2005
|
||||
#define BOOST_PROTO_ARGS_HPP_EAN_04_01_2005
|
||||
#ifndef BOOST_PROTO_ARGS_HPP_EAN_04_01_2005
|
||||
#define BOOST_PROTO_ARGS_HPP_EAN_04_01_2005
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/arithmetic/dec.hpp>
|
||||
#include <boost/preprocessor/iteration/iterate.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/repeat.hpp>
|
||||
#include <boost/preprocessor/repetition/repeat_from_to.hpp>
|
||||
#include <boost/type_traits/is_function.hpp>
|
||||
#include <boost/type_traits/is_abstract.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/or.hpp>
|
||||
#include <boost/mpl/void.hpp>
|
||||
#include <boost/proto/proto_fwd.hpp>
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/arithmetic/dec.hpp>
|
||||
#include <boost/preprocessor/iteration/iterate.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/repeat.hpp>
|
||||
#include <boost/preprocessor/repetition/repeat_from_to.hpp>
|
||||
#include <boost/type_traits/is_function.hpp>
|
||||
#include <boost/type_traits/is_abstract.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/or.hpp>
|
||||
#include <boost/mpl/void.hpp>
|
||||
#include <boost/proto/proto_fwd.hpp>
|
||||
|
||||
namespace boost { namespace proto
|
||||
namespace boost { namespace proto
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
namespace detail
|
||||
// All classes derived from std::ios_base have these public nested types,
|
||||
// and are non-copyable. This is an imperfect test, but it's the best we
|
||||
// we can do.
|
||||
template<typename T>
|
||||
yes_type check_is_iostream(
|
||||
typename T::failure *
|
||||
, typename T::Init *
|
||||
, typename T::fmtflags *
|
||||
, typename T::iostate *
|
||||
, typename T::openmode *
|
||||
, typename T::seekdir *
|
||||
);
|
||||
|
||||
template<typename T>
|
||||
no_type check_is_iostream(...);
|
||||
|
||||
template<typename T>
|
||||
struct is_iostream
|
||||
{
|
||||
// All classes derived from std::ios_base have these public nested types,
|
||||
// and are non-copyable. This is an imperfect test, but it's the best we
|
||||
// we can do.
|
||||
template<typename T>
|
||||
yes_type check_is_iostream(
|
||||
typename T::failure *
|
||||
, typename T::Init *
|
||||
, typename T::fmtflags *
|
||||
, typename T::iostate *
|
||||
, typename T::openmode *
|
||||
, typename T::seekdir *
|
||||
);
|
||||
|
||||
template<typename T>
|
||||
no_type check_is_iostream(...);
|
||||
|
||||
template<typename T>
|
||||
struct is_iostream
|
||||
{
|
||||
static bool const value = sizeof(yes_type) == sizeof(check_is_iostream<T>(0,0,0,0,0,0));
|
||||
typedef mpl::bool_<value> type;
|
||||
};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
// This should be a customization point. And it serves the same purpose
|
||||
// as the is_noncopyable trait in Boost.Foreach.
|
||||
template<typename T>
|
||||
struct ref_only
|
||||
: mpl::or_<
|
||||
is_function<T>
|
||||
, is_abstract<T>
|
||||
, is_iostream<T>
|
||||
>
|
||||
{};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<typename Expr>
|
||||
struct expr_traits
|
||||
{
|
||||
typedef Expr value_type;
|
||||
typedef Expr &reference;
|
||||
typedef Expr const &const_reference;
|
||||
};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<typename Expr>
|
||||
struct expr_traits<Expr &>
|
||||
{
|
||||
typedef Expr value_type;
|
||||
typedef Expr &reference;
|
||||
typedef Expr &const_reference;
|
||||
};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<typename Expr>
|
||||
struct expr_traits<Expr const &>
|
||||
{
|
||||
typedef Expr value_type;
|
||||
typedef Expr const &reference;
|
||||
typedef Expr const &const_reference;
|
||||
};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<typename T>
|
||||
struct term_traits
|
||||
{
|
||||
typedef T value_type;
|
||||
typedef T &reference;
|
||||
typedef T const &const_reference;
|
||||
};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<typename T>
|
||||
struct term_traits<T &>
|
||||
{
|
||||
typedef typename mpl::if_c<ref_only<T>::value, T &, T>::type value_type;
|
||||
typedef T &reference;
|
||||
typedef T &const_reference;
|
||||
};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<typename T>
|
||||
struct term_traits<T const &>
|
||||
{
|
||||
typedef T value_type;
|
||||
typedef T const &reference;
|
||||
typedef T const &const_reference;
|
||||
};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<typename T, std::size_t N>
|
||||
struct term_traits<T (&)[N]>
|
||||
{
|
||||
typedef T value_type[N];
|
||||
typedef T (&reference)[N];
|
||||
typedef T (&const_reference)[N];
|
||||
};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<typename T, std::size_t N>
|
||||
struct term_traits<T const (&)[N]>
|
||||
{
|
||||
typedef T value_type[N];
|
||||
typedef T const (&reference)[N];
|
||||
typedef T const (&const_reference)[N];
|
||||
};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<typename T, std::size_t N>
|
||||
struct term_traits<T[N]>
|
||||
{
|
||||
typedef T value_type[N];
|
||||
typedef T (&reference)[N];
|
||||
typedef T const (&const_reference)[N];
|
||||
};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<typename T, std::size_t N>
|
||||
struct term_traits<T const[N]>
|
||||
{
|
||||
typedef T value_type[N];
|
||||
typedef T const (&reference)[N];
|
||||
typedef T const (&const_reference)[N];
|
||||
};
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#define BOOST_PROTO_DEFINE_CHILD_N(Z, N, DATA) \
|
||||
typedef BOOST_PP_CAT(Arg, N) BOOST_PP_CAT(child, N); \
|
||||
/**< INTERNAL ONLY */
|
||||
|
||||
#define BOOST_PROTO_DEFINE_VOID_N(z, n, data) \
|
||||
typedef mpl::void_ BOOST_PP_CAT(child, n); \
|
||||
/**< INTERNAL ONLY */
|
||||
|
||||
namespace argsns_
|
||||
{
|
||||
/// \brief A type sequence, for use as the 2nd parameter to the \c expr\<\> class template.
|
||||
///
|
||||
/// A type sequence, for use as the 2nd parameter to the \c expr\<\> class template.
|
||||
/// The types in the sequence correspond to the children of a node in an expression tree.
|
||||
template< typename Arg0 >
|
||||
struct term
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(long, arity = 0);
|
||||
typedef Arg0 child0;
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1500))
|
||||
BOOST_PP_REPEAT_FROM_TO(1, BOOST_PROTO_MAX_ARITY, BOOST_PROTO_DEFINE_VOID_N, ~)
|
||||
#endif
|
||||
|
||||
/// INTERNAL ONLY
|
||||
///
|
||||
typedef Arg0 back_;
|
||||
};
|
||||
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 (3, (1, BOOST_PROTO_MAX_ARITY, <boost/proto/args.hpp>))
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
#undef BOOST_PROTO_DEFINE_CHILD_N
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
}}
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#define N BOOST_PP_ITERATION()
|
||||
|
||||
/// \brief A type sequence, for use as the 2nd parameter to the \c expr\<\> class template.
|
||||
///
|
||||
/// A type sequence, for use as the 2nd parameter to the \c expr\<\> class template.
|
||||
/// The types in the sequence correspond to the children of a node in an expression tree.
|
||||
template< BOOST_PP_ENUM_PARAMS(N, typename Arg) >
|
||||
struct BOOST_PP_CAT(list, N)
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(long, arity = N);
|
||||
BOOST_PP_REPEAT(N, BOOST_PROTO_DEFINE_CHILD_N, ~)
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1500))
|
||||
BOOST_PP_REPEAT_FROM_TO(N, BOOST_PROTO_MAX_ARITY, BOOST_PROTO_DEFINE_VOID_N, ~)
|
||||
#endif
|
||||
|
||||
/// INTERNAL ONLY
|
||||
///
|
||||
typedef BOOST_PP_CAT(Arg, BOOST_PP_DEC(N)) back_;
|
||||
static bool const value = sizeof(yes_type) == sizeof(check_is_iostream<T>(0,0,0,0,0,0));
|
||||
typedef mpl::bool_<value> type;
|
||||
};
|
||||
|
||||
#undef N
|
||||
/// INTERNAL ONLY
|
||||
// This should be a customization point. And it serves the same purpose
|
||||
// as the is_noncopyable trait in Boost.Foreach.
|
||||
template<typename T>
|
||||
struct ref_only
|
||||
: mpl::or_<
|
||||
is_function<T>
|
||||
, is_abstract<T>
|
||||
, is_iostream<T>
|
||||
>
|
||||
{};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<typename Expr>
|
||||
struct expr_traits
|
||||
{
|
||||
typedef Expr value_type;
|
||||
typedef Expr &reference;
|
||||
typedef Expr const &const_reference;
|
||||
};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<typename Expr>
|
||||
struct expr_traits<Expr &>
|
||||
{
|
||||
typedef Expr value_type;
|
||||
typedef Expr &reference;
|
||||
typedef Expr &const_reference;
|
||||
};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<typename Expr>
|
||||
struct expr_traits<Expr const &>
|
||||
{
|
||||
typedef Expr value_type;
|
||||
typedef Expr const &reference;
|
||||
typedef Expr const &const_reference;
|
||||
};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<typename T>
|
||||
struct term_traits
|
||||
{
|
||||
typedef T value_type;
|
||||
typedef T &reference;
|
||||
typedef T const &const_reference;
|
||||
};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<typename T>
|
||||
struct term_traits<T &>
|
||||
{
|
||||
typedef typename mpl::if_c<ref_only<T>::value, T &, T>::type value_type;
|
||||
typedef T &reference;
|
||||
typedef T &const_reference;
|
||||
};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<typename T>
|
||||
struct term_traits<T const &>
|
||||
{
|
||||
typedef T value_type;
|
||||
typedef T const &reference;
|
||||
typedef T const &const_reference;
|
||||
};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<typename T, std::size_t N>
|
||||
struct term_traits<T (&)[N]>
|
||||
{
|
||||
typedef T value_type[N];
|
||||
typedef T (&reference)[N];
|
||||
typedef T (&const_reference)[N];
|
||||
};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<typename T, std::size_t N>
|
||||
struct term_traits<T const (&)[N]>
|
||||
{
|
||||
typedef T value_type[N];
|
||||
typedef T const (&reference)[N];
|
||||
typedef T const (&const_reference)[N];
|
||||
};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<typename T, std::size_t N>
|
||||
struct term_traits<T[N]>
|
||||
{
|
||||
typedef T value_type[N];
|
||||
typedef T (&reference)[N];
|
||||
typedef T const (&const_reference)[N];
|
||||
};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<typename T, std::size_t N>
|
||||
struct term_traits<T const[N]>
|
||||
{
|
||||
typedef T value_type[N];
|
||||
typedef T const (&reference)[N];
|
||||
typedef T const (&const_reference)[N];
|
||||
};
|
||||
}
|
||||
|
||||
namespace argsns_
|
||||
{
|
||||
// This is where term and all the different listN templates are defined
|
||||
#include <boost/proto/detail/args.hpp>
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -1,65 +1,96 @@
|
||||
#ifndef BOOST_PP_IS_ITERATING
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file deep_copy.hpp
|
||||
/// Replace all nodes stored by reference by nodes stored by value.
|
||||
//
|
||||
// Copyright 2008 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file deep_copy.hpp
|
||||
/// Replace all nodes stored by reference by nodes stored by value.
|
||||
//
|
||||
// Copyright 2008 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_PROTO_DEEP_COPY_HPP_EAN_11_21_2006
|
||||
#define BOOST_PROTO_DEEP_COPY_HPP_EAN_11_21_2006
|
||||
#ifndef BOOST_PROTO_DEEP_COPY_HPP_EAN_11_21_2006
|
||||
#define BOOST_PROTO_DEEP_COPY_HPP_EAN_11_21_2006
|
||||
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/repetition/enum.hpp>
|
||||
#include <boost/preprocessor/iteration/iterate.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
#include <boost/proto/proto_fwd.hpp>
|
||||
#include <boost/proto/args.hpp>
|
||||
#include <boost/proto/expr.hpp>
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/repetition/enum.hpp>
|
||||
#include <boost/preprocessor/iteration/iterate.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
#include <boost/proto/proto_fwd.hpp>
|
||||
#include <boost/proto/args.hpp>
|
||||
#include <boost/proto/expr.hpp>
|
||||
|
||||
namespace boost { namespace proto
|
||||
namespace boost { namespace proto
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
template<typename Expr, long Arity = Expr::proto_arity_c>
|
||||
struct deep_copy_impl;
|
||||
template<typename Expr, long Arity = Expr::proto_arity_c>
|
||||
struct deep_copy_impl;
|
||||
|
||||
template<typename Expr>
|
||||
struct deep_copy_impl<Expr, 0>
|
||||
template<typename Expr>
|
||||
struct deep_copy_impl<Expr, 0>
|
||||
{
|
||||
typedef
|
||||
typename base_expr<
|
||||
typename Expr::proto_domain
|
||||
, tag::terminal
|
||||
, term<typename term_traits<typename Expr::proto_child0>::value_type>
|
||||
>::type
|
||||
expr_type;
|
||||
|
||||
typedef typename Expr::proto_generator proto_generator;
|
||||
typedef typename proto_generator::template result<proto_generator(expr_type)>::type result_type;
|
||||
|
||||
template<typename Expr2, typename S, typename D>
|
||||
result_type operator()(Expr2 const &e, S const &, D const &) const
|
||||
{
|
||||
typedef
|
||||
typename base_expr<
|
||||
typename Expr::proto_domain
|
||||
, tag::terminal
|
||||
, term<typename term_traits<typename Expr::proto_child0>::value_type>
|
||||
>::type
|
||||
expr_type;
|
||||
return proto_generator()(expr_type::make(e.proto_base().child0));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
typedef typename Expr::proto_generator proto_generator;
|
||||
typedef typename proto_generator::template result<proto_generator(expr_type)>::type result_type;
|
||||
|
||||
template<typename Expr2, typename S, typename D>
|
||||
result_type operator()(Expr2 const &e, S const &, D const &) const
|
||||
{
|
||||
return proto_generator()(expr_type::make(e.proto_base().child0));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
namespace result_of
|
||||
namespace result_of
|
||||
{
|
||||
/// \brief A metafunction for calculating the return type
|
||||
/// of \c proto::deep_copy().
|
||||
///
|
||||
/// A metafunction for calculating the return type
|
||||
/// of \c proto::deep_copy(). The type parameter \c Expr
|
||||
/// should be the type of a Proto expression tree.
|
||||
/// It should not be a reference type, nor should it
|
||||
/// be cv-qualified.
|
||||
template<typename Expr>
|
||||
struct deep_copy
|
||||
{
|
||||
/// \brief A metafunction for calculating the return type
|
||||
/// of \c proto::deep_copy().
|
||||
///
|
||||
/// A metafunction for calculating the return type
|
||||
/// of \c proto::deep_copy(). The type parameter \c Expr
|
||||
/// should be the type of a Proto expression tree.
|
||||
/// It should not be a reference type, nor should it
|
||||
/// be cv-qualified.
|
||||
template<typename Expr>
|
||||
struct deep_copy
|
||||
typedef
|
||||
typename detail::deep_copy_impl<
|
||||
BOOST_PROTO_UNCVREF(Expr)
|
||||
>::result_type
|
||||
type;
|
||||
};
|
||||
}
|
||||
|
||||
namespace functional
|
||||
{
|
||||
/// \brief A PolymorphicFunctionObject type for deep-copying
|
||||
/// Proto expression trees.
|
||||
///
|
||||
/// A PolymorphicFunctionObject type for deep-copying
|
||||
/// Proto expression trees. When a tree is deep-copied,
|
||||
/// all internal nodes and most terminals held by reference
|
||||
/// are instead held by value.
|
||||
///
|
||||
/// \attention Terminals of reference-to-function type are
|
||||
/// left unchanged. Terminals of reference-to-array type are
|
||||
/// stored by value, which can cause a large amount of data
|
||||
/// to be passed by value and stored on the stack.
|
||||
struct deep_copy
|
||||
{
|
||||
BOOST_PROTO_CALLABLE()
|
||||
|
||||
template<typename Sig>
|
||||
struct result;
|
||||
|
||||
template<typename This, typename Expr>
|
||||
struct result<This(Expr)>
|
||||
{
|
||||
typedef
|
||||
typename detail::deep_copy_impl<
|
||||
@ -67,147 +98,66 @@
|
||||
>::result_type
|
||||
type;
|
||||
};
|
||||
}
|
||||
|
||||
namespace functional
|
||||
{
|
||||
/// \brief A PolymorphicFunctionObject type for deep-copying
|
||||
/// Proto expression trees.
|
||||
///
|
||||
/// A PolymorphicFunctionObject type for deep-copying
|
||||
/// Proto expression trees. When a tree is deep-copied,
|
||||
/// all internal nodes and most terminals held by reference
|
||||
/// are instead held by value.
|
||||
///
|
||||
/// \attention Terminals of reference-to-function type are
|
||||
/// left unchanged. Terminals of reference-to-array type are
|
||||
/// stored by value, which can cause a large amount of data
|
||||
/// to be passed by value and stored on the stack.
|
||||
struct deep_copy
|
||||
{
|
||||
BOOST_PROTO_CALLABLE()
|
||||
|
||||
template<typename Sig>
|
||||
struct result;
|
||||
|
||||
template<typename This, typename Expr>
|
||||
struct result<This(Expr)>
|
||||
{
|
||||
typedef
|
||||
typename detail::deep_copy_impl<
|
||||
BOOST_PROTO_UNCVREF(Expr)
|
||||
>::result_type
|
||||
type;
|
||||
};
|
||||
|
||||
/// \brief Deep-copies a Proto expression tree, turning all
|
||||
/// nodes and terminals held by reference into ones held by
|
||||
/// value.
|
||||
template<typename Expr>
|
||||
typename result_of::deep_copy<Expr>::type
|
||||
operator()(Expr const &e) const
|
||||
{
|
||||
return proto::detail::deep_copy_impl<Expr>()(e, 0, 0);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/// \brief A function for deep-copying
|
||||
/// Proto expression trees.
|
||||
///
|
||||
/// A function for deep-copying
|
||||
/// Proto expression trees. When a tree is deep-copied,
|
||||
/// all internal nodes and most terminals held by reference
|
||||
/// are instead held by value.
|
||||
///
|
||||
/// \attention Terminals of reference-to-function type are
|
||||
/// left unchanged.
|
||||
///
|
||||
/// \sa proto::functional::deep_copy.
|
||||
template<typename Expr>
|
||||
typename proto::result_of::deep_copy<Expr>::type
|
||||
deep_copy(Expr const &e)
|
||||
{
|
||||
return proto::detail::deep_copy_impl<Expr>()(e, 0, 0);
|
||||
}
|
||||
|
||||
/// \brief A PrimitiveTransform for deep-copying
|
||||
/// Proto expression trees.
|
||||
///
|
||||
/// A PrimitiveTransform for deep-copying
|
||||
/// Proto expression trees. When a tree is deep-copied,
|
||||
/// all internal nodes and most terminals held by reference
|
||||
/// are instead held by value.
|
||||
///
|
||||
/// \attention Terminals of reference-to-function type are
|
||||
/// left unchanged.
|
||||
///
|
||||
/// \sa proto::functional::deep_copy.
|
||||
struct _deep_copy
|
||||
: proto::transform<_deep_copy>
|
||||
{
|
||||
template<typename E, typename S, typename D>
|
||||
struct impl
|
||||
: detail::deep_copy_impl<BOOST_PROTO_UNCVREF(E)>
|
||||
{};
|
||||
};
|
||||
|
||||
namespace detail
|
||||
{
|
||||
#define BOOST_PROTO_DEFINE_DEEP_COPY_TYPE(Z, N, DATA) \
|
||||
typename deep_copy_impl< \
|
||||
typename remove_reference< \
|
||||
typename Expr::BOOST_PP_CAT(proto_child, N) \
|
||||
>::type::proto_derived_expr \
|
||||
>::result_type \
|
||||
/**/
|
||||
|
||||
#define BOOST_PROTO_DEFINE_DEEP_COPY_FUN(Z, N, DATA) \
|
||||
proto::deep_copy(e.proto_base().BOOST_PP_CAT(child, N)) \
|
||||
/**/
|
||||
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 (3, (1, BOOST_PROTO_MAX_ARITY, <boost/proto/deep_copy.hpp>))
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
#undef BOOST_PROTO_DEFINE_DEEP_COPY_FUN
|
||||
#undef BOOST_PROTO_DEFINE_DEEP_COPY_TYPE
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
#endif // BOOST_PROTO_COMPILER_DEEP_COPY_HPP_EAN_11_21_2006
|
||||
|
||||
#else
|
||||
|
||||
#define N BOOST_PP_ITERATION()
|
||||
|
||||
/// \brief Deep-copies a Proto expression tree, turning all
|
||||
/// nodes and terminals held by reference into ones held by
|
||||
/// value.
|
||||
template<typename Expr>
|
||||
struct deep_copy_impl<Expr, N>
|
||||
typename result_of::deep_copy<Expr>::type
|
||||
operator()(Expr const &e) const
|
||||
{
|
||||
typedef
|
||||
typename base_expr<
|
||||
typename Expr::proto_domain
|
||||
, typename Expr::proto_tag
|
||||
, BOOST_PP_CAT(list, N)<
|
||||
BOOST_PP_ENUM(N, BOOST_PROTO_DEFINE_DEEP_COPY_TYPE, ~)
|
||||
>
|
||||
>::type
|
||||
expr_type;
|
||||
return proto::detail::deep_copy_impl<Expr>()(e, 0, 0);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
typedef typename Expr::proto_generator proto_generator;
|
||||
typedef typename proto_generator::template result<proto_generator(expr_type)>::type result_type;
|
||||
/// \brief A function for deep-copying
|
||||
/// Proto expression trees.
|
||||
///
|
||||
/// A function for deep-copying
|
||||
/// Proto expression trees. When a tree is deep-copied,
|
||||
/// all internal nodes and most terminals held by reference
|
||||
/// are instead held by value.
|
||||
///
|
||||
/// \attention Terminals of reference-to-function type are
|
||||
/// left unchanged.
|
||||
///
|
||||
/// \sa proto::functional::deep_copy.
|
||||
template<typename Expr>
|
||||
typename proto::result_of::deep_copy<Expr>::type
|
||||
deep_copy(Expr const &e)
|
||||
{
|
||||
return proto::detail::deep_copy_impl<Expr>()(e, 0, 0);
|
||||
}
|
||||
|
||||
template<typename Expr2, typename S, typename D>
|
||||
result_type operator()(Expr2 const &e, S const &, D const &) const
|
||||
{
|
||||
expr_type const that = {
|
||||
BOOST_PP_ENUM(N, BOOST_PROTO_DEFINE_DEEP_COPY_FUN, ~)
|
||||
};
|
||||
/// \brief A PrimitiveTransform for deep-copying
|
||||
/// Proto expression trees.
|
||||
///
|
||||
/// A PrimitiveTransform for deep-copying
|
||||
/// Proto expression trees. When a tree is deep-copied,
|
||||
/// all internal nodes and most terminals held by reference
|
||||
/// are instead held by value.
|
||||
///
|
||||
/// \attention Terminals of reference-to-function type are
|
||||
/// left unchanged.
|
||||
///
|
||||
/// \sa proto::functional::deep_copy.
|
||||
struct _deep_copy
|
||||
: proto::transform<_deep_copy>
|
||||
{
|
||||
template<typename E, typename S, typename D>
|
||||
struct impl
|
||||
: detail::deep_copy_impl<BOOST_PROTO_UNCVREF(E)>
|
||||
{};
|
||||
};
|
||||
|
||||
return proto_generator()(that);
|
||||
}
|
||||
};
|
||||
namespace detail
|
||||
{
|
||||
// include the definition of deep_copy_impl
|
||||
#include <boost/proto/detail/deep_copy.hpp>
|
||||
}
|
||||
|
||||
#undef N
|
||||
}}
|
||||
|
||||
#endif // BOOST_PROTO_COMPILER_DEEP_COPY_HPP_EAN_11_21_2006
|
||||
|
||||
#endif
|
||||
|
85
include/boost/proto/detail/args.hpp
Normal file
85
include/boost/proto/detail/args.hpp
Normal file
@ -0,0 +1,85 @@
|
||||
#if !defined(BOOST_PROTO_DONT_USE_PREPROCESSED_FILES)
|
||||
|
||||
#include <boost/proto/detail/preprocessed/args.hpp>
|
||||
|
||||
#elif !defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
/// INTERNAL ONLY
|
||||
///
|
||||
#define BOOST_PROTO_DEFINE_CHILD_N(Z, N, DATA) \
|
||||
typedef BOOST_PP_CAT(Arg, N) BOOST_PP_CAT(child, N); \
|
||||
/**< INTERNAL ONLY */
|
||||
|
||||
/// INTERNAL ONLY
|
||||
///
|
||||
#define BOOST_PROTO_DEFINE_VOID_N(z, n, data) \
|
||||
typedef mpl::void_ BOOST_PP_CAT(child, n); \
|
||||
/**< INTERNAL ONLY */
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 2, line: 0, output: "preprocessed/args.hpp")
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file args.hpp
|
||||
/// Contains definition of \c term\<\>, \c list1\<\>, \c list2\<\>, ...
|
||||
/// class templates.
|
||||
//
|
||||
// Copyright 2008 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 1)
|
||||
#endif
|
||||
|
||||
/// \brief A type sequence, for use as the 2nd parameter to the \c expr\<\> class template.
|
||||
///
|
||||
/// A type sequence, for use as the 2nd parameter to the \c expr\<\> class template.
|
||||
/// The types in the sequence correspond to the children of a node in an expression tree.
|
||||
template< typename Arg0 >
|
||||
struct term
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(long, arity = 0);
|
||||
typedef Arg0 child0;
|
||||
BOOST_PP_REPEAT_FROM_TO(1, BOOST_PROTO_MAX_ARITY, BOOST_PROTO_DEFINE_VOID_N, ~)
|
||||
|
||||
/// INTERNAL ONLY
|
||||
///
|
||||
typedef Arg0 back_;
|
||||
};
|
||||
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3, (1, BOOST_PROTO_MAX_ARITY, <boost/proto/detail/args.hpp>))
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(output: null)
|
||||
#endif
|
||||
|
||||
#undef BOOST_PROTO_DEFINE_VOID_N
|
||||
#undef BOOST_PROTO_DEFINE_CHILD_N
|
||||
|
||||
#else
|
||||
|
||||
#define N BOOST_PP_ITERATION()
|
||||
|
||||
/// \brief A type sequence, for use as the 2nd parameter to the \c expr\<\> class template.
|
||||
///
|
||||
/// A type sequence, for use as the 2nd parameter to the \c expr\<\> class template.
|
||||
/// The types in the sequence correspond to the children of a node in an expression tree.
|
||||
template< BOOST_PP_ENUM_PARAMS(N, typename Arg) >
|
||||
struct BOOST_PP_CAT(list, N)
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(long, arity = N);
|
||||
BOOST_PP_REPEAT(N, BOOST_PROTO_DEFINE_CHILD_N, ~)
|
||||
BOOST_PP_REPEAT_FROM_TO(N, BOOST_PROTO_MAX_ARITY, BOOST_PROTO_DEFINE_VOID_N, ~)
|
||||
|
||||
/// INTERNAL ONLY
|
||||
///
|
||||
typedef BOOST_PP_CAT(Arg, BOOST_PP_DEC(N)) back_;
|
||||
};
|
||||
|
||||
#undef N
|
||||
|
||||
#endif
|
180
include/boost/proto/detail/basic_expr.hpp
Normal file
180
include/boost/proto/detail/basic_expr.hpp
Normal file
@ -0,0 +1,180 @@
|
||||
#if !defined(BOOST_PROTO_DONT_USE_PREPROCESSED_FILES)
|
||||
|
||||
#include <boost/proto/detail/preprocessed/basic_expr.hpp>
|
||||
|
||||
#elif !defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
/// INTERNAL ONLY
|
||||
///
|
||||
#define BOOST_PROTO_CHILD(Z, N, DATA) \
|
||||
typedef BOOST_PP_CAT(Arg, N) BOOST_PP_CAT(proto_child, N); \
|
||||
BOOST_PP_CAT(proto_child, N) BOOST_PP_CAT(child, N); \
|
||||
/**< INTERNAL ONLY */
|
||||
|
||||
/// INTERNAL ONLY
|
||||
///
|
||||
#define BOOST_PROTO_VOID(Z, N, DATA) \
|
||||
typedef void BOOST_PP_CAT(proto_child, N); \
|
||||
/**< INTERNAL ONLY */
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 2, line: 0, output: "preprocessed/basic_expr.hpp")
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file basic_expr.hpp
|
||||
/// Contains definition of basic_expr\<\> class template.
|
||||
//
|
||||
// Copyright 2008 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 1)
|
||||
#endif
|
||||
|
||||
// The expr<> specializations are actually defined here.
|
||||
#define BOOST_PROTO_DEFINE_TERMINAL
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 (3, (0, 0, <boost/proto/detail/basic_expr.hpp>))
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
#undef BOOST_PROTO_DEFINE_TERMINAL
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 (3, (1, BOOST_PROTO_MAX_ARITY, <boost/proto/detail/basic_expr.hpp>))
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
// Generate non-variadic versions of expr and basic_expr
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(output: null)
|
||||
#endif
|
||||
|
||||
#undef BOOST_PROTO_CHILD
|
||||
#undef BOOST_PROTO_VOID
|
||||
|
||||
#else
|
||||
|
||||
#define ARG_COUNT BOOST_PP_MAX(1, BOOST_PP_ITERATION())
|
||||
|
||||
/// \brief Simplified representation of a node in an expression tree.
|
||||
///
|
||||
/// \c proto::basic_expr\<\> is a node in an expression template tree. It
|
||||
/// is a container for its child sub-trees. It also serves as
|
||||
/// the terminal nodes of the tree.
|
||||
///
|
||||
/// \c Tag is type that represents the operation encoded by
|
||||
/// this expression. It is typically one of the structs
|
||||
/// in the \c boost::proto::tag namespace, but it doesn't
|
||||
/// have to be.
|
||||
///
|
||||
/// \c Args is a type list representing the type of the children
|
||||
/// of this expression. It is an instantiation of one
|
||||
/// of \c proto::list1\<\>, \c proto::list2\<\>, etc. The
|
||||
/// child types must all themselves be either \c expr\<\>
|
||||
/// or <tt>proto::expr\<\>&</tt>. If \c Args is an
|
||||
/// instantiation of \c proto::term\<\> then this
|
||||
/// \c expr\<\> type represents a terminal expression;
|
||||
/// the parameter to the \c proto::term\<\> template
|
||||
/// represents the terminal's value type.
|
||||
///
|
||||
/// \c Arity is an integral constant representing the number of child
|
||||
/// nodes this node contains. If \c Arity is 0, then this
|
||||
/// node is a terminal.
|
||||
///
|
||||
/// \c proto::basic_expr\<\> is a valid Fusion random-access sequence, where
|
||||
/// the elements of the sequence are the child expressions.
|
||||
#ifdef BOOST_PROTO_DEFINE_TERMINAL
|
||||
template<typename Tag, typename Arg0>
|
||||
struct basic_expr<Tag, term<Arg0>, 0>
|
||||
#else
|
||||
template<typename Tag BOOST_PP_ENUM_TRAILING_PARAMS(ARG_COUNT, typename Arg)>
|
||||
struct basic_expr<Tag, BOOST_PP_CAT(list, BOOST_PP_ITERATION())<BOOST_PP_ENUM_PARAMS(ARG_COUNT, Arg)>, BOOST_PP_ITERATION() >
|
||||
#endif
|
||||
{
|
||||
typedef Tag proto_tag;
|
||||
BOOST_STATIC_CONSTANT(long, proto_arity_c = BOOST_PP_ITERATION());
|
||||
typedef mpl::long_<BOOST_PP_ITERATION() > proto_arity;
|
||||
typedef basic_expr proto_base_expr;
|
||||
#ifdef BOOST_PROTO_DEFINE_TERMINAL
|
||||
typedef term<Arg0> proto_args;
|
||||
#else
|
||||
typedef BOOST_PP_CAT(list, BOOST_PP_ITERATION())<BOOST_PP_ENUM_PARAMS(ARG_COUNT, Arg)> proto_args;
|
||||
#endif
|
||||
typedef basic_expr proto_grammar;
|
||||
typedef default_domain proto_domain;
|
||||
typedef default_generator proto_generator;
|
||||
typedef proto::tag::proto_expr fusion_tag;
|
||||
typedef basic_expr proto_derived_expr;
|
||||
typedef void proto_is_expr_; /**< INTERNAL ONLY */
|
||||
|
||||
BOOST_PP_REPEAT(ARG_COUNT, BOOST_PROTO_CHILD, ~)
|
||||
BOOST_PP_REPEAT_FROM_TO(ARG_COUNT, BOOST_PROTO_MAX_ARITY, BOOST_PROTO_VOID, ~)
|
||||
|
||||
/// \return *this
|
||||
///
|
||||
basic_expr const &proto_base() const
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
/// \overload
|
||||
///
|
||||
basic_expr &proto_base()
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
#ifdef BOOST_PROTO_DEFINE_TERMINAL
|
||||
/// \return A new \c expr\<\> object initialized with the specified
|
||||
/// arguments.
|
||||
///
|
||||
template<typename A0>
|
||||
static basic_expr const make(A0 &a0)
|
||||
{
|
||||
return detail::make_terminal(a0, static_cast<basic_expr *>(0), static_cast<proto_args *>(0));
|
||||
}
|
||||
|
||||
/// \overload
|
||||
///
|
||||
template<typename A0>
|
||||
static basic_expr const make(A0 const &a0)
|
||||
{
|
||||
return detail::make_terminal(a0, static_cast<basic_expr *>(0), static_cast<proto_args *>(0));
|
||||
}
|
||||
#else
|
||||
/// \return A new \c expr\<\> object initialized with the specified
|
||||
/// arguments.
|
||||
///
|
||||
template<BOOST_PP_ENUM_PARAMS(ARG_COUNT, typename A)>
|
||||
static basic_expr const make(BOOST_PP_ENUM_BINARY_PARAMS(ARG_COUNT, A, const &a))
|
||||
{
|
||||
basic_expr that = {BOOST_PP_ENUM_PARAMS(ARG_COUNT, a)};
|
||||
return that;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 1 == BOOST_PP_ITERATION()
|
||||
/// If \c Tag is \c boost::proto::tag::address_of and \c proto_child0 is
|
||||
/// <tt>T&</tt>, then \c address_of_hack_type_ is <tt>T*</tt>.
|
||||
/// Otherwise, it is some undefined type.
|
||||
typedef typename detail::address_of_hack<Tag, proto_child0>::type address_of_hack_type_;
|
||||
|
||||
/// \return The address of <tt>this->child0</tt> if \c Tag is
|
||||
/// \c boost::proto::tag::address_of. Otherwise, this function will
|
||||
/// fail to compile.
|
||||
///
|
||||
/// \attention Proto overloads <tt>operator&</tt>, which means that
|
||||
/// proto-ified objects cannot have their addresses taken, unless we use
|
||||
/// the following hack to make \c &x implicitly convertible to \c X*.
|
||||
operator address_of_hack_type_() const
|
||||
{
|
||||
return boost::addressof(this->child0);
|
||||
}
|
||||
#else
|
||||
/// INTERNAL ONLY
|
||||
///
|
||||
typedef detail::not_a_valid_type address_of_hack_type_;
|
||||
#endif
|
||||
};
|
||||
|
||||
#undef ARG_COUNT
|
||||
|
||||
#endif
|
79
include/boost/proto/detail/deep_copy.hpp
Normal file
79
include/boost/proto/detail/deep_copy.hpp
Normal file
@ -0,0 +1,79 @@
|
||||
#if !defined(BOOST_PROTO_DONT_USE_PREPROCESSED_FILES)
|
||||
|
||||
#include <boost/proto/detail/preprocessed/deep_copy.hpp>
|
||||
|
||||
#elif !defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
#define BOOST_PROTO_DEFINE_DEEP_COPY_TYPE(Z, N, DATA) \
|
||||
typename deep_copy_impl< \
|
||||
typename remove_reference< \
|
||||
typename Expr::BOOST_PP_CAT(proto_child, N) \
|
||||
>::type::proto_derived_expr \
|
||||
>::result_type \
|
||||
/**/
|
||||
|
||||
#define BOOST_PROTO_DEFINE_DEEP_COPY_FUN(Z, N, DATA) \
|
||||
proto::deep_copy(e.proto_base().BOOST_PP_CAT(child, N)) \
|
||||
/**/
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 2, line: 0, output: "preprocessed/deep_copy.hpp")
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file deep_copy.hpp
|
||||
/// Replace all nodes stored by reference by nodes stored by value.
|
||||
//
|
||||
// Copyright 2008 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 1)
|
||||
#endif
|
||||
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3, (1, BOOST_PROTO_MAX_ARITY, <boost/proto/detail/deep_copy.hpp>))
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(output: null)
|
||||
#endif
|
||||
|
||||
#undef BOOST_PROTO_DEFINE_DEEP_COPY_FUN
|
||||
#undef BOOST_PROTO_DEFINE_DEEP_COPY_TYPE
|
||||
|
||||
#else
|
||||
|
||||
#define N BOOST_PP_ITERATION()
|
||||
|
||||
template<typename Expr>
|
||||
struct deep_copy_impl<Expr, N>
|
||||
{
|
||||
typedef
|
||||
typename base_expr<
|
||||
typename Expr::proto_domain
|
||||
, typename Expr::proto_tag
|
||||
, BOOST_PP_CAT(list, N)<
|
||||
BOOST_PP_ENUM(N, BOOST_PROTO_DEFINE_DEEP_COPY_TYPE, ~)
|
||||
>
|
||||
>::type
|
||||
expr_type;
|
||||
|
||||
typedef typename Expr::proto_generator proto_generator;
|
||||
typedef typename proto_generator::template result<proto_generator(expr_type)>::type result_type;
|
||||
|
||||
template<typename Expr2, typename S, typename D>
|
||||
result_type operator()(Expr2 const &e, S const &, D const &) const
|
||||
{
|
||||
expr_type const that = {
|
||||
BOOST_PP_ENUM(N, BOOST_PROTO_DEFINE_DEEP_COPY_FUN, ~)
|
||||
};
|
||||
|
||||
return proto_generator()(that);
|
||||
}
|
||||
};
|
||||
|
||||
#undef N
|
||||
|
||||
#endif
|
@ -8,6 +8,19 @@
|
||||
|
||||
#elif !defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
/// INTERNAL ONLY
|
||||
///
|
||||
#define BOOST_PROTO_CHILD(Z, N, DATA) \
|
||||
typedef BOOST_PP_CAT(Arg, N) BOOST_PP_CAT(proto_child, N); \
|
||||
BOOST_PP_CAT(proto_child, N) BOOST_PP_CAT(child, N); \
|
||||
/**< INTERNAL ONLY */
|
||||
|
||||
/// INTERNAL ONLY
|
||||
///
|
||||
#define BOOST_PROTO_VOID(Z, N, DATA) \
|
||||
typedef void BOOST_PP_CAT(proto_child, N); \
|
||||
/**< INTERNAL ONLY */
|
||||
|
||||
// Generate variadic versions of expr
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 2, line: 0, output: "preprocessed/expr_variadic.hpp")
|
||||
@ -25,19 +38,6 @@
|
||||
#pragma wave option(preserve: 1)
|
||||
#endif
|
||||
|
||||
/// INTERNAL ONLY
|
||||
///
|
||||
#define BOOST_PROTO_CHILD(Z, N, DATA) \
|
||||
typedef BOOST_PP_CAT(Arg, N) BOOST_PP_CAT(proto_child, N); \
|
||||
BOOST_PP_CAT(proto_child, N) BOOST_PP_CAT(child, N); \
|
||||
/**< INTERNAL ONLY */
|
||||
|
||||
/// INTERNAL ONLY
|
||||
///
|
||||
#define BOOST_PROTO_VOID(Z, N, DATA) \
|
||||
typedef void BOOST_PP_CAT(proto_child, N); \
|
||||
/**< INTERNAL ONLY */
|
||||
|
||||
// The expr<> specializations are actually defined here.
|
||||
#define BOOST_PROTO_DEFINE_TERMINAL
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
|
43
include/boost/proto/detail/extends_funop.hpp
Normal file
43
include/boost/proto/detail/extends_funop.hpp
Normal file
@ -0,0 +1,43 @@
|
||||
#if !defined(BOOST_PROTO_DONT_USE_PREPROCESSED_FILES)
|
||||
|
||||
#ifndef BOOST_NO_VARIADIC_TEMPLATES
|
||||
BOOST_PROTO_EXTENDS_FUNCTION_()
|
||||
BOOST_PROTO_DEFINE_FUN_OP_VARIADIC_IMPL_(BOOST_PP_EMPTY)
|
||||
BOOST_PROTO_DEFINE_FUN_OP_VARIADIC_IMPL_(BOOST_PROTO_CONST)
|
||||
#else
|
||||
#include <boost/proto/detail/preprocessed/extends_funop.hpp>
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#define BOOST_PP_LOCAL_MACRO(N) \
|
||||
BOOST_PROTO_DEFINE_FUN_OP(1, N, ~) \
|
||||
/**/
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES) && !defined(BOOST_PROTO_NO_WAVE_OUTPUT)
|
||||
#pragma wave option(preserve: 2, line: 0, output: "preprocessed/extends_funop.hpp")
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file extends_funop.hpp
|
||||
/// Definitions for extends\<\>::operator()
|
||||
//
|
||||
// Copyright 2008 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES) && !defined(BOOST_PROTO_NO_WAVE_OUTPUT)
|
||||
#pragma wave option(preserve: 1)
|
||||
#endif
|
||||
|
||||
BOOST_PROTO_EXTENDS_FUNCTION_()
|
||||
|
||||
#define BOOST_PP_LOCAL_LIMITS \
|
||||
(0, BOOST_PP_DEC(BOOST_PROTO_MAX_FUNCTION_CALL_ARITY))
|
||||
#include BOOST_PP_LOCAL_ITERATE()
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES) && !defined(BOOST_PROTO_NO_WAVE_OUTPUT)
|
||||
#pragma wave option(output: null)
|
||||
#endif
|
||||
|
||||
#endif
|
42
include/boost/proto/detail/extends_funop_const.hpp
Normal file
42
include/boost/proto/detail/extends_funop_const.hpp
Normal file
@ -0,0 +1,42 @@
|
||||
#if !defined(BOOST_PROTO_DONT_USE_PREPROCESSED_FILES)
|
||||
|
||||
#ifndef BOOST_NO_VARIADIC_TEMPLATES
|
||||
BOOST_PROTO_EXTENDS_FUNCTION_()
|
||||
BOOST_PROTO_DEFINE_FUN_OP_VARIADIC_IMPL_(BOOST_PROTO_CONST)
|
||||
#else
|
||||
#include <boost/proto/detail/preprocessed/extends_funop_const.hpp>
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#define BOOST_PP_LOCAL_MACRO(N) \
|
||||
BOOST_PROTO_DEFINE_FUN_OP_CONST(1, N, ~) \
|
||||
/**/
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 2, line: 0, output: "preprocessed/extends_funop_const.hpp")
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file extends_funop_const.hpp
|
||||
/// Definitions for extends\<\>::operator()
|
||||
//
|
||||
// Copyright 2008 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 1)
|
||||
#endif
|
||||
|
||||
BOOST_PROTO_EXTENDS_FUNCTION_()
|
||||
|
||||
#define BOOST_PP_LOCAL_LIMITS \
|
||||
(0, BOOST_PP_DEC(BOOST_PROTO_MAX_FUNCTION_CALL_ARITY))
|
||||
#include BOOST_PP_LOCAL_ITERATE()
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(output: null)
|
||||
#endif
|
||||
|
||||
#endif
|
@ -4,6 +4,15 @@
|
||||
|
||||
#elif !defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/arithmetic/dec.hpp>
|
||||
#include <boost/preprocessor/iteration/iterate.hpp>
|
||||
#include <boost/preprocessor/facilities/intercept.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_trailing.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_trailing_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_trailing_binary_params.hpp>
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 2, line: 0, output: "preprocessed/funop.hpp")
|
||||
#endif
|
||||
|
92
include/boost/proto/detail/preprocessed/args.hpp
Normal file
92
include/boost/proto/detail/preprocessed/args.hpp
Normal file
@ -0,0 +1,92 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file args.hpp
|
||||
/// Contains definition of \c term\<\>, \c list1\<\>, \c list2\<\>, ...
|
||||
/// class templates.
|
||||
//
|
||||
// Copyright 2008 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
|
||||
|
||||
template< typename Arg0 >
|
||||
struct term
|
||||
{
|
||||
static const long arity = 0;
|
||||
typedef Arg0 child0;
|
||||
typedef mpl::void_ child1; typedef mpl::void_ child2; typedef mpl::void_ child3; typedef mpl::void_ child4;
|
||||
|
||||
|
||||
typedef Arg0 back_;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
template< typename Arg0 >
|
||||
struct list1
|
||||
{
|
||||
static const long arity = 1;
|
||||
typedef Arg0 child0;
|
||||
typedef mpl::void_ child1; typedef mpl::void_ child2; typedef mpl::void_ child3; typedef mpl::void_ child4;
|
||||
|
||||
|
||||
typedef Arg0 back_;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
template< typename Arg0 , typename Arg1 >
|
||||
struct list2
|
||||
{
|
||||
static const long arity = 2;
|
||||
typedef Arg0 child0; typedef Arg1 child1;
|
||||
typedef mpl::void_ child2; typedef mpl::void_ child3; typedef mpl::void_ child4;
|
||||
|
||||
|
||||
typedef Arg1 back_;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
template< typename Arg0 , typename Arg1 , typename Arg2 >
|
||||
struct list3
|
||||
{
|
||||
static const long arity = 3;
|
||||
typedef Arg0 child0; typedef Arg1 child1; typedef Arg2 child2;
|
||||
typedef mpl::void_ child3; typedef mpl::void_ child4;
|
||||
|
||||
|
||||
typedef Arg2 back_;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
template< typename Arg0 , typename Arg1 , typename Arg2 , typename Arg3 >
|
||||
struct list4
|
||||
{
|
||||
static const long arity = 4;
|
||||
typedef Arg0 child0; typedef Arg1 child1; typedef Arg2 child2; typedef Arg3 child3;
|
||||
typedef mpl::void_ child4;
|
||||
|
||||
|
||||
typedef Arg3 back_;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
template< typename Arg0 , typename Arg1 , typename Arg2 , typename Arg3 , typename Arg4 >
|
||||
struct list5
|
||||
{
|
||||
static const long arity = 5;
|
||||
typedef Arg0 child0; typedef Arg1 child1; typedef Arg2 child2; typedef Arg3 child3; typedef Arg4 child4;
|
||||
|
||||
|
||||
|
||||
typedef Arg4 back_;
|
||||
};
|
@ -28,10 +28,6 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
122
include/boost/proto/detail/preprocessed/deep_copy.hpp
Normal file
122
include/boost/proto/detail/preprocessed/deep_copy.hpp
Normal file
@ -0,0 +1,122 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file deep_copy.hpp
|
||||
/// Replace all nodes stored by reference by nodes stored by value.
|
||||
//
|
||||
// Copyright 2008 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
template<typename Expr>
|
||||
struct deep_copy_impl<Expr, 1>
|
||||
{
|
||||
typedef
|
||||
typename base_expr<
|
||||
typename Expr::proto_domain
|
||||
, typename Expr::proto_tag
|
||||
, list1<
|
||||
typename deep_copy_impl< typename remove_reference< typename Expr::proto_child0 >::type::proto_derived_expr >::result_type
|
||||
>
|
||||
>::type
|
||||
expr_type;
|
||||
typedef typename Expr::proto_generator proto_generator;
|
||||
typedef typename proto_generator::template result<proto_generator(expr_type)>::type result_type;
|
||||
template<typename Expr2, typename S, typename D>
|
||||
result_type operator()(Expr2 const &e, S const &, D const &) const
|
||||
{
|
||||
expr_type const that = {
|
||||
proto::deep_copy(e.proto_base().child0)
|
||||
};
|
||||
return proto_generator()(that);
|
||||
}
|
||||
};
|
||||
template<typename Expr>
|
||||
struct deep_copy_impl<Expr, 2>
|
||||
{
|
||||
typedef
|
||||
typename base_expr<
|
||||
typename Expr::proto_domain
|
||||
, typename Expr::proto_tag
|
||||
, list2<
|
||||
typename deep_copy_impl< typename remove_reference< typename Expr::proto_child0 >::type::proto_derived_expr >::result_type , typename deep_copy_impl< typename remove_reference< typename Expr::proto_child1 >::type::proto_derived_expr >::result_type
|
||||
>
|
||||
>::type
|
||||
expr_type;
|
||||
typedef typename Expr::proto_generator proto_generator;
|
||||
typedef typename proto_generator::template result<proto_generator(expr_type)>::type result_type;
|
||||
template<typename Expr2, typename S, typename D>
|
||||
result_type operator()(Expr2 const &e, S const &, D const &) const
|
||||
{
|
||||
expr_type const that = {
|
||||
proto::deep_copy(e.proto_base().child0) , proto::deep_copy(e.proto_base().child1)
|
||||
};
|
||||
return proto_generator()(that);
|
||||
}
|
||||
};
|
||||
template<typename Expr>
|
||||
struct deep_copy_impl<Expr, 3>
|
||||
{
|
||||
typedef
|
||||
typename base_expr<
|
||||
typename Expr::proto_domain
|
||||
, typename Expr::proto_tag
|
||||
, list3<
|
||||
typename deep_copy_impl< typename remove_reference< typename Expr::proto_child0 >::type::proto_derived_expr >::result_type , typename deep_copy_impl< typename remove_reference< typename Expr::proto_child1 >::type::proto_derived_expr >::result_type , typename deep_copy_impl< typename remove_reference< typename Expr::proto_child2 >::type::proto_derived_expr >::result_type
|
||||
>
|
||||
>::type
|
||||
expr_type;
|
||||
typedef typename Expr::proto_generator proto_generator;
|
||||
typedef typename proto_generator::template result<proto_generator(expr_type)>::type result_type;
|
||||
template<typename Expr2, typename S, typename D>
|
||||
result_type operator()(Expr2 const &e, S const &, D const &) const
|
||||
{
|
||||
expr_type const that = {
|
||||
proto::deep_copy(e.proto_base().child0) , proto::deep_copy(e.proto_base().child1) , proto::deep_copy(e.proto_base().child2)
|
||||
};
|
||||
return proto_generator()(that);
|
||||
}
|
||||
};
|
||||
template<typename Expr>
|
||||
struct deep_copy_impl<Expr, 4>
|
||||
{
|
||||
typedef
|
||||
typename base_expr<
|
||||
typename Expr::proto_domain
|
||||
, typename Expr::proto_tag
|
||||
, list4<
|
||||
typename deep_copy_impl< typename remove_reference< typename Expr::proto_child0 >::type::proto_derived_expr >::result_type , typename deep_copy_impl< typename remove_reference< typename Expr::proto_child1 >::type::proto_derived_expr >::result_type , typename deep_copy_impl< typename remove_reference< typename Expr::proto_child2 >::type::proto_derived_expr >::result_type , typename deep_copy_impl< typename remove_reference< typename Expr::proto_child3 >::type::proto_derived_expr >::result_type
|
||||
>
|
||||
>::type
|
||||
expr_type;
|
||||
typedef typename Expr::proto_generator proto_generator;
|
||||
typedef typename proto_generator::template result<proto_generator(expr_type)>::type result_type;
|
||||
template<typename Expr2, typename S, typename D>
|
||||
result_type operator()(Expr2 const &e, S const &, D const &) const
|
||||
{
|
||||
expr_type const that = {
|
||||
proto::deep_copy(e.proto_base().child0) , proto::deep_copy(e.proto_base().child1) , proto::deep_copy(e.proto_base().child2) , proto::deep_copy(e.proto_base().child3)
|
||||
};
|
||||
return proto_generator()(that);
|
||||
}
|
||||
};
|
||||
template<typename Expr>
|
||||
struct deep_copy_impl<Expr, 5>
|
||||
{
|
||||
typedef
|
||||
typename base_expr<
|
||||
typename Expr::proto_domain
|
||||
, typename Expr::proto_tag
|
||||
, list5<
|
||||
typename deep_copy_impl< typename remove_reference< typename Expr::proto_child0 >::type::proto_derived_expr >::result_type , typename deep_copy_impl< typename remove_reference< typename Expr::proto_child1 >::type::proto_derived_expr >::result_type , typename deep_copy_impl< typename remove_reference< typename Expr::proto_child2 >::type::proto_derived_expr >::result_type , typename deep_copy_impl< typename remove_reference< typename Expr::proto_child3 >::type::proto_derived_expr >::result_type , typename deep_copy_impl< typename remove_reference< typename Expr::proto_child4 >::type::proto_derived_expr >::result_type
|
||||
>
|
||||
>::type
|
||||
expr_type;
|
||||
typedef typename Expr::proto_generator proto_generator;
|
||||
typedef typename proto_generator::template result<proto_generator(expr_type)>::type result_type;
|
||||
template<typename Expr2, typename S, typename D>
|
||||
result_type operator()(Expr2 const &e, S const &, D const &) const
|
||||
{
|
||||
expr_type const that = {
|
||||
proto::deep_copy(e.proto_base().child0) , proto::deep_copy(e.proto_base().child1) , proto::deep_copy(e.proto_base().child2) , proto::deep_copy(e.proto_base().child3) , proto::deep_copy(e.proto_base().child4)
|
||||
};
|
||||
return proto_generator()(that);
|
||||
}
|
||||
};
|
@ -28,10 +28,6 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
13
include/boost/proto/detail/preprocessed/extends_funop.hpp
Normal file
13
include/boost/proto/detail/preprocessed/extends_funop.hpp
Normal file
@ -0,0 +1,13 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file extends_funop.hpp
|
||||
/// Definitions for extends\<\>::operator()
|
||||
//
|
||||
// Copyright 2008 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
template<typename Sig> struct result { typedef typename boost::tr1_result_of< proto_generator( typename boost::proto::result_of::funop< Sig , proto_derived_expr , proto_domain >::type ) >::type const type; };
|
||||
typename boost::tr1_result_of< proto_generator( typename boost::proto::result_of::funop0< proto_derived_expr const , proto_domain >::type ) >::type const operator ()() const { typedef boost::proto::result_of::funop0< proto_derived_expr const , proto_domain > funop; return proto_generator()( funop::call( *static_cast<proto_derived_expr const *>(this) ) ); } typename boost::tr1_result_of< proto_generator( typename boost::proto::result_of::funop0< proto_derived_expr , proto_domain >::type ) >::type const operator ()() { typedef boost::proto::result_of::funop0< proto_derived_expr , proto_domain > funop; return proto_generator()( funop::call( *static_cast<proto_derived_expr *>(this) ) ); }
|
||||
template<typename A0> typename boost::tr1_result_of< proto_generator( typename boost::proto::result_of::funop1< proto_derived_expr const , proto_domain , const A0 >::type ) >::type const operator ()(A0 const &a0) const { typedef boost::proto::result_of::funop1< proto_derived_expr const , proto_domain , const A0 > funop; return proto_generator()( funop::call( *static_cast<proto_derived_expr const *>(this) , a0 ) ); } template<typename A0> typename boost::tr1_result_of< proto_generator( typename boost::proto::result_of::funop1< proto_derived_expr , proto_domain , const A0 >::type ) >::type const operator ()(A0 const &a0) { typedef boost::proto::result_of::funop1< proto_derived_expr , proto_domain , const A0 > funop; return proto_generator()( funop::call( *static_cast<proto_derived_expr *>(this) , a0 ) ); }
|
||||
template<typename A0 , typename A1> typename boost::tr1_result_of< proto_generator( typename boost::proto::result_of::funop2< proto_derived_expr const , proto_domain , const A0 , const A1 >::type ) >::type const operator ()(A0 const &a0 , A1 const &a1) const { typedef boost::proto::result_of::funop2< proto_derived_expr const , proto_domain , const A0 , const A1 > funop; return proto_generator()( funop::call( *static_cast<proto_derived_expr const *>(this) , a0 , a1 ) ); } template<typename A0 , typename A1> typename boost::tr1_result_of< proto_generator( typename boost::proto::result_of::funop2< proto_derived_expr , proto_domain , const A0 , const A1 >::type ) >::type const operator ()(A0 const &a0 , A1 const &a1) { typedef boost::proto::result_of::funop2< proto_derived_expr , proto_domain , const A0 , const A1 > funop; return proto_generator()( funop::call( *static_cast<proto_derived_expr *>(this) , a0 , a1 ) ); }
|
||||
template<typename A0 , typename A1 , typename A2> typename boost::tr1_result_of< proto_generator( typename boost::proto::result_of::funop3< proto_derived_expr const , proto_domain , const A0 , const A1 , const A2 >::type ) >::type const operator ()(A0 const &a0 , A1 const &a1 , A2 const &a2) const { typedef boost::proto::result_of::funop3< proto_derived_expr const , proto_domain , const A0 , const A1 , const A2 > funop; return proto_generator()( funop::call( *static_cast<proto_derived_expr const *>(this) , a0 , a1 , a2 ) ); } template<typename A0 , typename A1 , typename A2> typename boost::tr1_result_of< proto_generator( typename boost::proto::result_of::funop3< proto_derived_expr , proto_domain , const A0 , const A1 , const A2 >::type ) >::type const operator ()(A0 const &a0 , A1 const &a1 , A2 const &a2) { typedef boost::proto::result_of::funop3< proto_derived_expr , proto_domain , const A0 , const A1 , const A2 > funop; return proto_generator()( funop::call( *static_cast<proto_derived_expr *>(this) , a0 , a1 , a2 ) ); }
|
||||
template<typename A0 , typename A1 , typename A2 , typename A3> typename boost::tr1_result_of< proto_generator( typename boost::proto::result_of::funop4< proto_derived_expr const , proto_domain , const A0 , const A1 , const A2 , const A3 >::type ) >::type const operator ()(A0 const &a0 , A1 const &a1 , A2 const &a2 , A3 const &a3) const { typedef boost::proto::result_of::funop4< proto_derived_expr const , proto_domain , const A0 , const A1 , const A2 , const A3 > funop; return proto_generator()( funop::call( *static_cast<proto_derived_expr const *>(this) , a0 , a1 , a2 , a3 ) ); } template<typename A0 , typename A1 , typename A2 , typename A3> typename boost::tr1_result_of< proto_generator( typename boost::proto::result_of::funop4< proto_derived_expr , proto_domain , const A0 , const A1 , const A2 , const A3 >::type ) >::type const operator ()(A0 const &a0 , A1 const &a1 , A2 const &a2 , A3 const &a3) { typedef boost::proto::result_of::funop4< proto_derived_expr , proto_domain , const A0 , const A1 , const A2 , const A3 > funop; return proto_generator()( funop::call( *static_cast<proto_derived_expr *>(this) , a0 , a1 , a2 , a3 ) ); }
|
@ -0,0 +1,13 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file extends_funop_const.hpp
|
||||
/// Definitions for extends\<\>::operator()
|
||||
//
|
||||
// Copyright 2008 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
template<typename Sig> struct result { typedef typename boost::tr1_result_of< proto_generator( typename boost::proto::result_of::funop< Sig , proto_derived_expr , proto_domain >::type ) >::type const type; };
|
||||
typename boost::tr1_result_of< proto_generator( typename boost::proto::result_of::funop0< proto_derived_expr const , proto_domain >::type ) >::type const operator ()() const { typedef boost::proto::result_of::funop0< proto_derived_expr const , proto_domain > funop; return proto_generator()( funop::call( *static_cast<proto_derived_expr const *>(this) ) ); }
|
||||
template<typename A0> typename boost::tr1_result_of< proto_generator( typename boost::proto::result_of::funop1< proto_derived_expr const , proto_domain , const A0 >::type ) >::type const operator ()(A0 const &a0) const { typedef boost::proto::result_of::funop1< proto_derived_expr const , proto_domain , const A0 > funop; return proto_generator()( funop::call( *static_cast<proto_derived_expr const *>(this) , a0 ) ); }
|
||||
template<typename A0 , typename A1> typename boost::tr1_result_of< proto_generator( typename boost::proto::result_of::funop2< proto_derived_expr const , proto_domain , const A0 , const A1 >::type ) >::type const operator ()(A0 const &a0 , A1 const &a1) const { typedef boost::proto::result_of::funop2< proto_derived_expr const , proto_domain , const A0 , const A1 > funop; return proto_generator()( funop::call( *static_cast<proto_derived_expr const *>(this) , a0 , a1 ) ); }
|
||||
template<typename A0 , typename A1 , typename A2> typename boost::tr1_result_of< proto_generator( typename boost::proto::result_of::funop3< proto_derived_expr const , proto_domain , const A0 , const A1 , const A2 >::type ) >::type const operator ()(A0 const &a0 , A1 const &a1 , A2 const &a2) const { typedef boost::proto::result_of::funop3< proto_derived_expr const , proto_domain , const A0 , const A1 , const A2 > funop; return proto_generator()( funop::call( *static_cast<proto_derived_expr const *>(this) , a0 , a1 , a2 ) ); }
|
||||
template<typename A0 , typename A1 , typename A2 , typename A3> typename boost::tr1_result_of< proto_generator( typename boost::proto::result_of::funop4< proto_derived_expr const , proto_domain , const A0 , const A1 , const A2 , const A3 >::type ) >::type const operator ()(A0 const &a0 , A1 const &a1 , A2 const &a2 , A3 const &a3) const { typedef boost::proto::result_of::funop4< proto_derived_expr const , proto_domain , const A0 , const A1 , const A2 , const A3 > funop; return proto_generator()( funop::call( *static_cast<proto_derived_expr const *>(this) , a0 , a1 , a2 , a3 ) ); }
|
@ -74,7 +74,7 @@ namespace boost { namespace proto
|
||||
///
|
||||
#define BOOST_PROTO_DEFINE_FUN_OP_IMPL_(Z, N, DATA, Const) \
|
||||
BOOST_PP_IF(N, BOOST_PROTO_TEMPLATE_YES_, BOOST_PROTO_TEMPLATE_NO_)(Z, N) \
|
||||
typename BOOST_PROTO_RESULT_OF< \
|
||||
typename BOOST_PROTO_RESULT_OF< \
|
||||
proto_generator( \
|
||||
typename boost::proto::result_of::BOOST_PP_CAT(funop, N)< \
|
||||
proto_derived_expr Const() \
|
||||
@ -103,7 +103,7 @@ namespace boost { namespace proto
|
||||
///
|
||||
#define BOOST_PROTO_DEFINE_FUN_OP_VARIADIC_IMPL_(Const) \
|
||||
template<typename... A> \
|
||||
typename BOOST_PROTO_RESULT_OF< \
|
||||
typename BOOST_PROTO_RESULT_OF< \
|
||||
proto_generator( \
|
||||
typename boost::proto::result_of::funop< \
|
||||
proto_derived_expr Const()(A const &...) \
|
||||
@ -202,7 +202,7 @@ namespace boost { namespace proto
|
||||
|
||||
#define BOOST_PROTO_EXTENDS_COPY_ASSIGN_IMPL_(This, Const, Typename) \
|
||||
BOOST_PROTO_DISABLE_MSVC_C4522 \
|
||||
Typename() BOOST_PROTO_RESULT_OF< \
|
||||
Typename() BOOST_PROTO_RESULT_OF< \
|
||||
Typename() This::proto_generator( \
|
||||
Typename() boost::proto::base_expr< \
|
||||
Typename() This::proto_domain \
|
||||
@ -251,7 +251,7 @@ namespace boost { namespace proto
|
||||
///
|
||||
#define BOOST_PROTO_EXTENDS_ASSIGN_IMPL_(ThisConst, ThatConst) \
|
||||
template<typename A> \
|
||||
typename BOOST_PROTO_RESULT_OF< \
|
||||
typename BOOST_PROTO_RESULT_OF< \
|
||||
proto_generator( \
|
||||
typename boost::proto::base_expr< \
|
||||
proto_domain \
|
||||
@ -317,7 +317,7 @@ namespace boost { namespace proto
|
||||
///
|
||||
#define BOOST_PROTO_EXTENDS_SUBSCRIPT_IMPL_(ThisConst, ThatConst) \
|
||||
template<typename A> \
|
||||
typename BOOST_PROTO_RESULT_OF< \
|
||||
typename BOOST_PROTO_RESULT_OF< \
|
||||
proto_generator( \
|
||||
typename boost::proto::base_expr< \
|
||||
proto_domain \
|
||||
@ -512,23 +512,7 @@ namespace boost { namespace proto
|
||||
// Instead of using BOOST_PROTO_EXTENDS_FUNCTION, which uses
|
||||
// nested preprocessor loops, use file iteration here to generate
|
||||
// the operator() overloads, which is more efficient.
|
||||
BOOST_PROTO_EXTENDS_FUNCTION_()
|
||||
|
||||
#ifndef BOOST_NO_VARIADIC_TEMPLATES
|
||||
BOOST_PROTO_DEFINE_FUN_OP_VARIADIC_IMPL_(BOOST_PROTO_CONST)
|
||||
#else
|
||||
/// INTERNAL ONLY
|
||||
///
|
||||
#define BOOST_PP_LOCAL_MACRO(N) \
|
||||
BOOST_PROTO_DEFINE_FUN_OP_CONST(1, N, ~) \
|
||||
/**/
|
||||
|
||||
/// INTERNAL ONLY
|
||||
///
|
||||
#define BOOST_PP_LOCAL_LIMITS (0, BOOST_PP_DEC(BOOST_PROTO_MAX_FUNCTION_CALL_ARITY))
|
||||
#include BOOST_PP_LOCAL_ITERATE()
|
||||
|
||||
#endif
|
||||
#include <boost/proto/detail/extends_funop_const.hpp>
|
||||
};
|
||||
|
||||
/// \brief extends\<\> class template for adding behaviors to a Proto expression template
|
||||
@ -557,25 +541,7 @@ namespace boost { namespace proto
|
||||
// Instead of using BOOST_PROTO_EXTENDS_FUNCTION, which uses
|
||||
// nested preprocessor loops, use file iteration here to generate
|
||||
// the operator() overloads, which is more efficient.
|
||||
BOOST_PROTO_EXTENDS_FUNCTION_()
|
||||
|
||||
#ifndef BOOST_NO_VARIADIC_TEMPLATES
|
||||
BOOST_PROTO_DEFINE_FUN_OP_VARIADIC_IMPL_(BOOST_PP_EMPTY)
|
||||
BOOST_PROTO_DEFINE_FUN_OP_VARIADIC_IMPL_(BOOST_PROTO_CONST)
|
||||
#else
|
||||
|
||||
/// INTERNAL ONLY
|
||||
///
|
||||
#define BOOST_PP_LOCAL_MACRO(N) \
|
||||
BOOST_PROTO_DEFINE_FUN_OP(1, N, ~) \
|
||||
/**/
|
||||
|
||||
/// INTERNAL ONLY
|
||||
///
|
||||
#define BOOST_PP_LOCAL_LIMITS (0, BOOST_PP_DEC(BOOST_PROTO_MAX_FUNCTION_CALL_ARITY))
|
||||
#include BOOST_PP_LOCAL_ITERATE()
|
||||
|
||||
#endif
|
||||
#include <boost/proto/detail/extends_funop.hpp>
|
||||
};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
@ -601,7 +567,13 @@ namespace boost { namespace proto
|
||||
|
||||
BOOST_PROTO_EXTENDS_ASSIGN_()
|
||||
BOOST_PROTO_EXTENDS_SUBSCRIPT()
|
||||
BOOST_PROTO_EXTENDS_FUNCTION()
|
||||
|
||||
// Instead of using BOOST_PROTO_EXTENDS_FUNCTION, which uses
|
||||
// nested preprocessor loops, use file iteration here to generate
|
||||
// the operator() overloads, which is more efficient.
|
||||
#define BOOST_PROTO_NO_WAVE_OUTPUT
|
||||
#include <boost/proto/detail/extends_funop.hpp>
|
||||
#undef BOOST_PROTO_NO_WAVE_OUTPUT
|
||||
|
||||
proto_base_expr const proto_base() const
|
||||
{
|
||||
|
@ -9,4 +9,7 @@
|
||||
//#include <boost/proto/transform.hpp>
|
||||
//#include <boost/proto/functional.hpp>
|
||||
|
||||
#include <boost/proto/args.hpp>
|
||||
#include <boost/proto/expr.hpp>
|
||||
#include <boost/proto/extends.hpp>
|
||||
#include <boost/proto/deep_copy.hpp>
|
||||
|
Loading…
Reference in New Issue
Block a user