123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284 |
- #ifndef BOOST_PROTO_TRANSFORM_MAKE_HPP_EAN_12_02_2007
- #define BOOST_PROTO_TRANSFORM_MAKE_HPP_EAN_12_02_2007
- #include <boost/detail/workaround.hpp>
- #include <boost/preprocessor/repetition/enum.hpp>
- #include <boost/preprocessor/repetition/enum_params.hpp>
- #include <boost/preprocessor/repetition/enum_trailing_params.hpp>
- #include <boost/preprocessor/repetition/enum_binary_params.hpp>
- #include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
- #include <boost/preprocessor/repetition/repeat_from_to.hpp>
- #include <boost/preprocessor/facilities/intercept.hpp>
- #include <boost/preprocessor/cat.hpp>
- #include <boost/preprocessor/iteration/iterate.hpp>
- #include <boost/preprocessor/selection/max.hpp>
- #include <boost/preprocessor/arithmetic/inc.hpp>
- #include <boost/mpl/and.hpp>
- #include <boost/mpl/aux_/has_type.hpp>
- #include <boost/proto/detail/template_arity.hpp>
- #include <boost/utility/result_of.hpp>
- #include <boost/proto/proto_fwd.hpp>
- #include <boost/proto/traits.hpp>
- #include <boost/proto/args.hpp>
- #include <boost/proto/transform/impl.hpp>
- #include <boost/proto/transform/detail/pack.hpp>
- #include <boost/proto/detail/as_lvalue.hpp>
- #include <boost/proto/detail/ignore_unused.hpp>
- #if defined(_MSC_VER)
- # pragma warning(push)
- # pragma warning(disable : 4714)
- #endif
- namespace boost { namespace proto
- {
- namespace detail
- {
- template<typename T>
- struct is_applyable
- : mpl::and_<is_callable<T>, is_transform<T> >
- {};
- template<typename T, bool HasType = mpl::aux::has_type<T>::value>
- struct nested_type
- {
- typedef typename T::type type;
- };
- template<typename T>
- struct nested_type<T, false>
- {
- typedef T type;
- };
- template<typename T, bool Applied>
- struct nested_type_if
- {
- typedef T type;
- static bool const applied = false;
- };
- template<typename T>
- struct nested_type_if<T, true>
- : nested_type<T>
- {
- static bool const applied = true;
- };
- template<
- typename R
- , typename Expr, typename State, typename Data
- BOOST_PROTO_TEMPLATE_ARITY_PARAM(long Arity = detail::template_arity<R>::value)
- >
- struct make_
- {
- typedef R type;
- static bool const applied = false;
- };
- template<
- typename R
- , typename Expr, typename State, typename Data
- , bool IsApplyable = is_applyable<R>::value
- >
- struct make_if_
- : make_<R, Expr, State, Data>
- {};
- template<typename R, typename Expr, typename State, typename Data>
- struct make_if_<R, Expr, State, Data, true>
- : uncvref<typename when<_, R>::template impl<Expr, State, Data>::result_type>
- {
- static bool const applied = true;
- };
- #if BOOST_WORKAROUND(__GNUC__, == 3) || (BOOST_WORKAROUND(__GNUC__, == 4) && __GNUC_MINOR__ == 0)
-
- template<typename Tag, typename Args, long N, typename Expr, typename State, typename Data>
- struct make_if_<proto::expr<Tag, Args, N>, Expr, State, Data, false>
- {
- typedef proto::expr<Tag, Args, N> type;
- static bool const applied = false;
- };
-
- template<typename Tag, typename Args, long N, typename Expr, typename State, typename Data>
- struct make_if_<proto::basic_expr<Tag, Args, N>, Expr, State, Data, false>
- {
- typedef proto::basic_expr<Tag, Args, N> type;
- static bool const applied = false;
- };
- #endif
- template<typename Type, bool IsAggregate = detail::is_aggregate_<Type>::value>
- struct construct_
- {
- typedef Type result_type;
- BOOST_FORCEINLINE
- Type operator ()() const
- {
- return Type();
- }
-
- #include <boost/proto/transform/detail/construct_funop.hpp>
- };
- template<typename Type>
- struct construct_<Type, true>
- {
- typedef Type result_type;
- BOOST_FORCEINLINE
- Type operator ()() const
- {
- return Type();
- }
-
- #include <boost/proto/transform/detail/construct_pod_funop.hpp>
- };
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- template<typename PrimitiveTransform>
- struct protect : transform<protect<PrimitiveTransform> >
- {
- template<typename, typename, typename>
- struct impl
- {
- typedef PrimitiveTransform result_type;
- };
- };
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- template<typename Object>
- struct make : transform<make<Object> >
- {
- template<typename Expr, typename State, typename Data>
- struct impl : transform_impl<Expr, State, Data>
- {
- typedef typename detail::make_if_<Object, Expr, State, Data>::type result_type;
-
- BOOST_FORCEINLINE
- result_type operator ()(
- typename impl::expr_param
- , typename impl::state_param
- , typename impl::data_param
- ) const
- {
- return result_type();
- }
- };
- };
-
- template<typename Fun>
- struct make<detail::msvc_fun_workaround<Fun> >
- : make<Fun>
- {};
-
- #include <boost/proto/transform/detail/make.hpp>
- #include <boost/proto/transform/detail/make_gcc_workaround.hpp>
-
-
- template<typename Object>
- struct is_callable<make<Object> >
- : mpl::true_
- {};
-
-
- template<typename PrimitiveTransform>
- struct is_callable<protect<PrimitiveTransform> >
- : mpl::true_
- {};
- }}
- #if defined(_MSC_VER)
- # pragma warning(pop)
- #endif
- #endif
|