|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r80579 - in branches/release: . boost boost/proto boost/proto/detail boost/proto/detail/preprocessed boost/proto/transform boost/proto/transform/detail boost/proto/transform/detail/preprocessed libs libs/proto/doc/reference/transform libs/proto/preprocess
From: eric_at_[hidden]
Date: 2012-09-18 13:00:49
Author: eric_niebler
Date: 2012-09-18 13:00:48 EDT (Tue, 18 Sep 2012)
New Revision: 80579
URL: http://svn.boost.org/trac/boost/changeset/80579
Log:
proto: merge [80353] from trunk to release
Properties modified:
branches/release/ (props changed)
branches/release/boost/ (props changed)
branches/release/libs/ (props changed)
Text files modified:
branches/release/boost/proto/detail/preprocessed/traits.hpp | 40 ++++----
branches/release/boost/proto/detail/traits.hpp | 4
branches/release/boost/proto/generate.hpp | 6 -
branches/release/boost/proto/matches.hpp | 12 --
branches/release/boost/proto/proto_fwd.hpp | 19 ++-
branches/release/boost/proto/traits.hpp | 22 +---
branches/release/boost/proto/transform/arg.hpp | 12 --
branches/release/boost/proto/transform/detail/pass_through_impl.hpp | 18 ++-
branches/release/boost/proto/transform/detail/preprocessed/pass_through_impl.hpp | 180 ++++++++++++++++++++++++++++-----------
branches/release/boost/proto/transform/env.hpp | 12 --
branches/release/boost/proto/transform/pass_through.hpp | 23 ++--
branches/release/libs/proto/doc/reference/transform/pass_through.xml | 24 ++++
branches/release/libs/proto/preprocess/wave.cfg | 1
13 files changed, 224 insertions(+), 149 deletions(-)
Modified: branches/release/boost/proto/detail/preprocessed/traits.hpp
==============================================================================
--- branches/release/boost/proto/detail/preprocessed/traits.hpp (original)
+++ branches/release/boost/proto/detail/preprocessed/traits.hpp 2012-09-18 13:00:48 EDT (Tue, 18 Sep 2012)
@@ -95,7 +95,7 @@
typedef proto::basic_expr<proto::tag::function, list1<A0>, 1> proto_grammar;
template<typename Expr, typename State, typename Data>
struct impl
- : detail::pass_through_impl<function, Expr, State, Data>
+ : detail::pass_through_impl<function, deduce_domain, Expr, State, Data>
{};
typedef proto::tag::function proto_tag;
@@ -130,7 +130,7 @@
typedef proto::basic_expr<Tag, list1<A0>, 1> proto_grammar;
template<typename Expr, typename State, typename Data>
struct impl
- : detail::pass_through_impl<nary_expr, Expr, State, Data>
+ : detail::pass_through_impl<nary_expr, deduce_domain, Expr, State, Data>
{};
typedef Tag proto_tag;
@@ -237,7 +237,7 @@
typedef proto::basic_expr<proto::tag::function, list2<A0 , A1>, 2> proto_grammar;
template<typename Expr, typename State, typename Data>
struct impl
- : detail::pass_through_impl<function, Expr, State, Data>
+ : detail::pass_through_impl<function, deduce_domain, Expr, State, Data>
{};
typedef proto::tag::function proto_tag;
@@ -272,7 +272,7 @@
typedef proto::basic_expr<Tag, list2<A0 , A1>, 2> proto_grammar;
template<typename Expr, typename State, typename Data>
struct impl
- : detail::pass_through_impl<nary_expr, Expr, State, Data>
+ : detail::pass_through_impl<nary_expr, deduce_domain, Expr, State, Data>
{};
typedef Tag proto_tag;
@@ -379,7 +379,7 @@
typedef proto::basic_expr<proto::tag::function, list3<A0 , A1 , A2>, 3> proto_grammar;
template<typename Expr, typename State, typename Data>
struct impl
- : detail::pass_through_impl<function, Expr, State, Data>
+ : detail::pass_through_impl<function, deduce_domain, Expr, State, Data>
{};
typedef proto::tag::function proto_tag;
@@ -414,7 +414,7 @@
typedef proto::basic_expr<Tag, list3<A0 , A1 , A2>, 3> proto_grammar;
template<typename Expr, typename State, typename Data>
struct impl
- : detail::pass_through_impl<nary_expr, Expr, State, Data>
+ : detail::pass_through_impl<nary_expr, deduce_domain, Expr, State, Data>
{};
typedef Tag proto_tag;
@@ -521,7 +521,7 @@
typedef proto::basic_expr<proto::tag::function, list4<A0 , A1 , A2 , A3>, 4> proto_grammar;
template<typename Expr, typename State, typename Data>
struct impl
- : detail::pass_through_impl<function, Expr, State, Data>
+ : detail::pass_through_impl<function, deduce_domain, Expr, State, Data>
{};
typedef proto::tag::function proto_tag;
@@ -556,7 +556,7 @@
typedef proto::basic_expr<Tag, list4<A0 , A1 , A2 , A3>, 4> proto_grammar;
template<typename Expr, typename State, typename Data>
struct impl
- : detail::pass_through_impl<nary_expr, Expr, State, Data>
+ : detail::pass_through_impl<nary_expr, deduce_domain, Expr, State, Data>
{};
typedef Tag proto_tag;
@@ -663,7 +663,7 @@
typedef proto::basic_expr<proto::tag::function, list5<A0 , A1 , A2 , A3 , A4>, 5> proto_grammar;
template<typename Expr, typename State, typename Data>
struct impl
- : detail::pass_through_impl<function, Expr, State, Data>
+ : detail::pass_through_impl<function, deduce_domain, Expr, State, Data>
{};
typedef proto::tag::function proto_tag;
@@ -698,7 +698,7 @@
typedef proto::basic_expr<Tag, list5<A0 , A1 , A2 , A3 , A4>, 5> proto_grammar;
template<typename Expr, typename State, typename Data>
struct impl
- : detail::pass_through_impl<nary_expr, Expr, State, Data>
+ : detail::pass_through_impl<nary_expr, deduce_domain, Expr, State, Data>
{};
typedef Tag proto_tag;
@@ -805,7 +805,7 @@
typedef proto::basic_expr<proto::tag::function, list6<A0 , A1 , A2 , A3 , A4 , A5>, 6> proto_grammar;
template<typename Expr, typename State, typename Data>
struct impl
- : detail::pass_through_impl<function, Expr, State, Data>
+ : detail::pass_through_impl<function, deduce_domain, Expr, State, Data>
{};
typedef proto::tag::function proto_tag;
@@ -840,7 +840,7 @@
typedef proto::basic_expr<Tag, list6<A0 , A1 , A2 , A3 , A4 , A5>, 6> proto_grammar;
template<typename Expr, typename State, typename Data>
struct impl
- : detail::pass_through_impl<nary_expr, Expr, State, Data>
+ : detail::pass_through_impl<nary_expr, deduce_domain, Expr, State, Data>
{};
typedef Tag proto_tag;
@@ -947,7 +947,7 @@
typedef proto::basic_expr<proto::tag::function, list7<A0 , A1 , A2 , A3 , A4 , A5 , A6>, 7> proto_grammar;
template<typename Expr, typename State, typename Data>
struct impl
- : detail::pass_through_impl<function, Expr, State, Data>
+ : detail::pass_through_impl<function, deduce_domain, Expr, State, Data>
{};
typedef proto::tag::function proto_tag;
@@ -982,7 +982,7 @@
typedef proto::basic_expr<Tag, list7<A0 , A1 , A2 , A3 , A4 , A5 , A6>, 7> proto_grammar;
template<typename Expr, typename State, typename Data>
struct impl
- : detail::pass_through_impl<nary_expr, Expr, State, Data>
+ : detail::pass_through_impl<nary_expr, deduce_domain, Expr, State, Data>
{};
typedef Tag proto_tag;
@@ -1089,7 +1089,7 @@
typedef proto::basic_expr<proto::tag::function, list8<A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7>, 8> proto_grammar;
template<typename Expr, typename State, typename Data>
struct impl
- : detail::pass_through_impl<function, Expr, State, Data>
+ : detail::pass_through_impl<function, deduce_domain, Expr, State, Data>
{};
typedef proto::tag::function proto_tag;
@@ -1124,7 +1124,7 @@
typedef proto::basic_expr<Tag, list8<A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7>, 8> proto_grammar;
template<typename Expr, typename State, typename Data>
struct impl
- : detail::pass_through_impl<nary_expr, Expr, State, Data>
+ : detail::pass_through_impl<nary_expr, deduce_domain, Expr, State, Data>
{};
typedef Tag proto_tag;
@@ -1231,7 +1231,7 @@
typedef proto::basic_expr<proto::tag::function, list9<A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8>, 9> proto_grammar;
template<typename Expr, typename State, typename Data>
struct impl
- : detail::pass_through_impl<function, Expr, State, Data>
+ : detail::pass_through_impl<function, deduce_domain, Expr, State, Data>
{};
typedef proto::tag::function proto_tag;
@@ -1266,7 +1266,7 @@
typedef proto::basic_expr<Tag, list9<A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8>, 9> proto_grammar;
template<typename Expr, typename State, typename Data>
struct impl
- : detail::pass_through_impl<nary_expr, Expr, State, Data>
+ : detail::pass_through_impl<nary_expr, deduce_domain, Expr, State, Data>
{};
typedef Tag proto_tag;
@@ -1369,7 +1369,7 @@
typedef proto::basic_expr<proto::tag::function, list10<A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9>, 10> proto_grammar;
template<typename Expr, typename State, typename Data>
struct impl
- : detail::pass_through_impl<function, Expr, State, Data>
+ : detail::pass_through_impl<function, deduce_domain, Expr, State, Data>
{};
typedef proto::tag::function proto_tag;
@@ -1399,7 +1399,7 @@
typedef proto::basic_expr<Tag, list10<A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9>, 10> proto_grammar;
template<typename Expr, typename State, typename Data>
struct impl
- : detail::pass_through_impl<nary_expr, Expr, State, Data>
+ : detail::pass_through_impl<nary_expr, deduce_domain, Expr, State, Data>
{};
typedef Tag proto_tag;
Modified: branches/release/boost/proto/detail/traits.hpp
==============================================================================
--- branches/release/boost/proto/detail/traits.hpp (original)
+++ branches/release/boost/proto/detail/traits.hpp 2012-09-18 13:00:48 EDT (Tue, 18 Sep 2012)
@@ -65,7 +65,7 @@
template<typename Expr, typename State, typename Data>
struct impl
- : detail::pass_through_impl<function, Expr, State, Data>
+ : detail::pass_through_impl<function, deduce_domain, Expr, State, Data>
{};
/// INTERNAL ONLY
@@ -110,7 +110,7 @@
template<typename Expr, typename State, typename Data>
struct impl
- : detail::pass_through_impl<nary_expr, Expr, State, Data>
+ : detail::pass_through_impl<nary_expr, deduce_domain, Expr, State, Data>
{};
/// INTERNAL ONLY
Modified: branches/release/boost/proto/generate.hpp
==============================================================================
--- branches/release/boost/proto/generate.hpp (original)
+++ branches/release/boost/proto/generate.hpp 2012-09-18 13:00:48 EDT (Tue, 18 Sep 2012)
@@ -116,11 +116,7 @@
/// \return expr
template<typename Expr>
BOOST_FORCEINLINE
- #ifdef BOOST_PROTO_STRICT_RESULT_OF
- Expr
- #else
- Expr const &
- #endif
+ BOOST_PROTO_RETURN_TYPE_STRICT_LOOSE(Expr, Expr const &)
operator ()(Expr const &e) const
{
return e;
Modified: branches/release/boost/proto/matches.hpp
==============================================================================
--- branches/release/boost/proto/matches.hpp (original)
+++ branches/release/boost/proto/matches.hpp 2012-09-18 13:00:48 EDT (Tue, 18 Sep 2012)
@@ -571,11 +571,7 @@
/// \param expr An expression
/// \return \c e
- #ifdef BOOST_PROTO_STRICT_RESULT_OF
- result_type
- #else
- typename impl::expr_param
- #endif
+ BOOST_PROTO_RETURN_TYPE_STRICT_LOOSE(result_type, typename impl::expr_param)
operator()(
typename impl::expr_param e
, typename impl::state_param
@@ -620,11 +616,7 @@
/// \param e An expression
/// \pre <tt>matches\<Expr,not_\>::value</tt> is \c true.
/// \return \c e
- #ifdef BOOST_PROTO_STRICT_RESULT_OF
- result_type
- #else
- typename impl::expr_param
- #endif
+ BOOST_PROTO_RETURN_TYPE_STRICT_LOOSE(result_type, typename impl::expr_param)
operator()(
typename impl::expr_param e
, typename impl::state_param
Modified: branches/release/boost/proto/proto_fwd.hpp
==============================================================================
--- branches/release/boost/proto/proto_fwd.hpp (original)
+++ branches/release/boost/proto/proto_fwd.hpp 2012-09-18 13:00:48 EDT (Tue, 18 Sep 2012)
@@ -25,6 +25,7 @@
#include <boost/type_traits/remove_const.hpp>
#include <boost/type_traits/remove_reference.hpp>
#include <boost/mpl/aux_/config/ttp.hpp>
+#include <boost/utility/result_of.hpp>
#ifndef BOOST_PROTO_MAX_ARITY
# define BOOST_PROTO_MAX_ARITY 10
@@ -92,18 +93,13 @@
# endif
#endif
-#ifndef BOOST_NO_DECLTYPE_N3276
+#ifdef BOOST_NO_DECLTYPE_N3276
# // Proto can only use the decltype-based result_of if N3276 has been
# // implemented by the compiler.
# // See http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2011/n3276.pdf
# ifndef BOOST_PROTO_USE_NORMAL_RESULT_OF
# define BOOST_PROTO_USE_NORMAL_RESULT_OF
# endif
-# // If we're using the decltype-based result_of, we need to be a bit
-# // stricter about the return types of some functions.
-# ifndef BOOST_PROTO_STRICT_RESULT_OF
-# define BOOST_PROTO_STRICT_RESULT_OF
-# endif
#endif
// Unless compiler support is there, use tr1_result_of instead of
@@ -114,6 +110,15 @@
# define BOOST_PROTO_RESULT_OF boost::tr1_result_of
#endif
+// If we're using the decltype-based result_of, we need to be a bit
+// stricter about the return types of some functions.
+#if defined(BOOST_RESULT_OF_USE_DECLTYPE) && defined(BOOST_PROTO_USE_NORMAL_RESULT_OF)
+# define BOOST_PROTO_STRICT_RESULT_OF
+# define BOOST_PROTO_RETURN_TYPE_STRICT_LOOSE(X, Y) X
+#else
+# define BOOST_PROTO_RETURN_TYPE_STRICT_LOOSE(X, Y) Y
+#endif
+
#ifdef BOOST_MPL_CFG_EXTENDED_TEMPLATE_PARAMETERS_MATCHING
# define BOOST_PROTO_EXTENDED_TEMPLATE_PARAMETERS_MATCHING
#endif
@@ -812,7 +817,7 @@
template<typename Sequence, typename State, typename Fun>
struct reverse_fold_tree;
- template<typename Grammar>
+ template<typename Grammar, typename Domain = deduce_domain>
struct pass_through;
template<typename Grammar = detail::_default>
Modified: branches/release/boost/proto/traits.hpp
==============================================================================
--- branches/release/boost/proto/traits.hpp (original)
+++ branches/release/boost/proto/traits.hpp 2012-09-18 13:00:48 EDT (Tue, 18 Sep 2012)
@@ -398,11 +398,7 @@
/// \return \c e
/// \throw nothrow
BOOST_FORCEINLINE
- #ifdef BOOST_PROTO_STRICT_RESULT_OF
- result_type
- #else
- typename impl::expr_param
- #endif
+ BOOST_PROTO_RETURN_TYPE_STRICT_LOOSE(result_type, typename impl::expr_param)
operator ()(
typename impl::expr_param e
, typename impl::state_param
@@ -432,7 +428,7 @@
template<typename Expr, typename State, typename Data>
struct impl
- : detail::pass_through_impl<if_else_, Expr, State, Data>
+ : detail::pass_through_impl<if_else_, deduce_domain, Expr, State, Data>
{};
/// INTERNAL ONLY
@@ -469,11 +465,7 @@
/// \return \c e
/// \throw nothrow
BOOST_FORCEINLINE
- #ifdef BOOST_PROTO_STRICT_RESULT_OF
- result_type
- #else
- typename impl::expr_param
- #endif
+ BOOST_PROTO_RETURN_TYPE_STRICT_LOOSE(result_type, typename impl::expr_param)
operator ()(
typename impl::expr_param e
, typename impl::state_param
@@ -507,7 +499,7 @@
template<typename Expr, typename State, typename Data>
struct impl
- : detail::pass_through_impl<unary_expr, Expr, State, Data>
+ : detail::pass_through_impl<unary_expr, deduce_domain, Expr, State, Data>
{};
/// INTERNAL ONLY
@@ -533,7 +525,7 @@
template<typename Expr, typename State, typename Data>
struct impl
- : detail::pass_through_impl<binary_expr, Expr, State, Data>
+ : detail::pass_through_impl<binary_expr, deduce_domain, Expr, State, Data>
{};
/// INTERNAL ONLY
@@ -554,7 +546,7 @@
\
template<typename Expr, typename State, typename Data> \
struct impl \
- : detail::pass_through_impl<Op, Expr, State, Data> \
+ : detail::pass_through_impl<Op, deduce_domain, Expr, State, Data> \
{}; \
\
typedef proto::tag::Op proto_tag; \
@@ -572,7 +564,7 @@
\
template<typename Expr, typename State, typename Data> \
struct impl \
- : detail::pass_through_impl<Op, Expr, State, Data> \
+ : detail::pass_through_impl<Op, deduce_domain, Expr, State, Data> \
{}; \
\
typedef proto::tag::Op proto_tag; \
Modified: branches/release/boost/proto/transform/arg.hpp
==============================================================================
--- branches/release/boost/proto/transform/arg.hpp (original)
+++ branches/release/boost/proto/transform/arg.hpp 2012-09-18 13:00:48 EDT (Tue, 18 Sep 2012)
@@ -40,11 +40,7 @@
/// \param e The current expression.
/// \return \c e
/// \throw nothrow
- #ifdef BOOST_PROTO_STRICT_RESULT_OF
- result_type
- #else
- typename impl::expr_param
- #endif
+ BOOST_PROTO_RETURN_TYPE_STRICT_LOOSE(result_type, typename impl::expr_param)
operator()(
typename impl::expr_param e
, typename impl::state_param
@@ -77,11 +73,7 @@
/// \param s The current state.
/// \return \c s
/// \throw nothrow
- #ifdef BOOST_PROTO_STRICT_RESULT_OF
- result_type
- #else
- typename impl::state_param
- #endif
+ BOOST_PROTO_RETURN_TYPE_STRICT_LOOSE(result_type, typename impl::state_param)
operator ()(
typename impl::expr_param
, typename impl::state_param s
Modified: branches/release/boost/proto/transform/detail/pass_through_impl.hpp
==============================================================================
--- branches/release/boost/proto/transform/detail/pass_through_impl.hpp (original)
+++ branches/release/boost/proto/transform/detail/pass_through_impl.hpp 2012-09-18 13:00:48 EDT (Tue, 18 Sep 2012)
@@ -54,15 +54,22 @@
#define N BOOST_PP_ITERATION()
- template<typename Grammar, typename Expr, typename State, typename Data>
- struct pass_through_impl<Grammar, Expr, State, Data, N>
+ template<typename Grammar, typename Domain, typename Expr, typename State, typename Data>
+ struct pass_through_impl<Grammar, Domain, Expr, State, Data, N>
: transform_impl<Expr, State, Data>
{
typedef typename pass_through_impl::expr unref_expr;
+ typedef
+ typename mpl::if_c<
+ is_same<Domain, deduce_domain>::value
+ , typename unref_expr::proto_domain
+ , Domain
+ >::type
+ result_domain;
typedef
typename base_expr<
- typename unref_expr::proto_domain
+ result_domain
, typename unref_expr::proto_tag
, BOOST_PP_CAT(list, N)<
BOOST_PP_ENUM(N, BOOST_PROTO_DEFINE_TRANSFORM_TYPE, ~)
@@ -70,11 +77,12 @@
>::type
expr_type;
- typedef typename unref_expr::proto_generator proto_generator;
+ typedef typename result_domain::proto_generator proto_generator;
typedef typename BOOST_PROTO_RESULT_OF<proto_generator(expr_type)>::type result_type;
BOOST_FORCEINLINE
- result_type const operator ()(
+ BOOST_PROTO_RETURN_TYPE_STRICT_LOOSE(result_type, result_type const)
+ operator ()(
typename pass_through_impl::expr_param e
, typename pass_through_impl::state_param s
, typename pass_through_impl::data_param d
Modified: branches/release/boost/proto/transform/detail/preprocessed/pass_through_impl.hpp
==============================================================================
--- branches/release/boost/proto/transform/detail/preprocessed/pass_through_impl.hpp (original)
+++ branches/release/boost/proto/transform/detail/preprocessed/pass_through_impl.hpp 2012-09-18 13:00:48 EDT (Tue, 18 Sep 2012)
@@ -7,24 +7,32 @@
// 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 Grammar, typename Expr, typename State, typename Data>
- struct pass_through_impl<Grammar, Expr, State, Data, 1>
+ template<typename Grammar, typename Domain, typename Expr, typename State, typename Data>
+ struct pass_through_impl<Grammar, Domain, Expr, State, Data, 1>
: transform_impl<Expr, State, Data>
{
typedef typename pass_through_impl::expr unref_expr;
typedef
+ typename mpl::if_c<
+ is_same<Domain, deduce_domain>::value
+ , typename unref_expr::proto_domain
+ , Domain
+ >::type
+ result_domain;
+ typedef
typename base_expr<
- typename unref_expr::proto_domain
+ result_domain
, typename unref_expr::proto_tag
, list1<
typename Grammar::proto_child0::template impl< typename result_of::child_c<Expr, 0>::type , State , Data >::result_type
>
>::type
expr_type;
- typedef typename unref_expr::proto_generator proto_generator;
+ typedef typename result_domain::proto_generator proto_generator;
typedef typename BOOST_PROTO_RESULT_OF<proto_generator(expr_type)>::type result_type;
BOOST_FORCEINLINE
- result_type const operator ()(
+ BOOST_PROTO_RETURN_TYPE_STRICT_LOOSE(result_type, result_type const)
+ operator ()(
typename pass_through_impl::expr_param e
, typename pass_through_impl::state_param s
, typename pass_through_impl::data_param d
@@ -40,24 +48,32 @@
return proto_generator()(that);
}
};
- template<typename Grammar, typename Expr, typename State, typename Data>
- struct pass_through_impl<Grammar, Expr, State, Data, 2>
+ template<typename Grammar, typename Domain, typename Expr, typename State, typename Data>
+ struct pass_through_impl<Grammar, Domain, Expr, State, Data, 2>
: transform_impl<Expr, State, Data>
{
typedef typename pass_through_impl::expr unref_expr;
typedef
+ typename mpl::if_c<
+ is_same<Domain, deduce_domain>::value
+ , typename unref_expr::proto_domain
+ , Domain
+ >::type
+ result_domain;
+ typedef
typename base_expr<
- typename unref_expr::proto_domain
+ result_domain
, typename unref_expr::proto_tag
, list2<
typename Grammar::proto_child0::template impl< typename result_of::child_c<Expr, 0>::type , State , Data >::result_type , typename Grammar::proto_child1::template impl< typename result_of::child_c<Expr, 1>::type , State , Data >::result_type
>
>::type
expr_type;
- typedef typename unref_expr::proto_generator proto_generator;
+ typedef typename result_domain::proto_generator proto_generator;
typedef typename BOOST_PROTO_RESULT_OF<proto_generator(expr_type)>::type result_type;
BOOST_FORCEINLINE
- result_type const operator ()(
+ BOOST_PROTO_RETURN_TYPE_STRICT_LOOSE(result_type, result_type const)
+ operator ()(
typename pass_through_impl::expr_param e
, typename pass_through_impl::state_param s
, typename pass_through_impl::data_param d
@@ -73,24 +89,32 @@
return proto_generator()(that);
}
};
- template<typename Grammar, typename Expr, typename State, typename Data>
- struct pass_through_impl<Grammar, Expr, State, Data, 3>
+ template<typename Grammar, typename Domain, typename Expr, typename State, typename Data>
+ struct pass_through_impl<Grammar, Domain, Expr, State, Data, 3>
: transform_impl<Expr, State, Data>
{
typedef typename pass_through_impl::expr unref_expr;
typedef
+ typename mpl::if_c<
+ is_same<Domain, deduce_domain>::value
+ , typename unref_expr::proto_domain
+ , Domain
+ >::type
+ result_domain;
+ typedef
typename base_expr<
- typename unref_expr::proto_domain
+ result_domain
, typename unref_expr::proto_tag
, list3<
typename Grammar::proto_child0::template impl< typename result_of::child_c<Expr, 0>::type , State , Data >::result_type , typename Grammar::proto_child1::template impl< typename result_of::child_c<Expr, 1>::type , State , Data >::result_type , typename Grammar::proto_child2::template impl< typename result_of::child_c<Expr, 2>::type , State , Data >::result_type
>
>::type
expr_type;
- typedef typename unref_expr::proto_generator proto_generator;
+ typedef typename result_domain::proto_generator proto_generator;
typedef typename BOOST_PROTO_RESULT_OF<proto_generator(expr_type)>::type result_type;
BOOST_FORCEINLINE
- result_type const operator ()(
+ BOOST_PROTO_RETURN_TYPE_STRICT_LOOSE(result_type, result_type const)
+ operator ()(
typename pass_through_impl::expr_param e
, typename pass_through_impl::state_param s
, typename pass_through_impl::data_param d
@@ -106,24 +130,32 @@
return proto_generator()(that);
}
};
- template<typename Grammar, typename Expr, typename State, typename Data>
- struct pass_through_impl<Grammar, Expr, State, Data, 4>
+ template<typename Grammar, typename Domain, typename Expr, typename State, typename Data>
+ struct pass_through_impl<Grammar, Domain, Expr, State, Data, 4>
: transform_impl<Expr, State, Data>
{
typedef typename pass_through_impl::expr unref_expr;
typedef
+ typename mpl::if_c<
+ is_same<Domain, deduce_domain>::value
+ , typename unref_expr::proto_domain
+ , Domain
+ >::type
+ result_domain;
+ typedef
typename base_expr<
- typename unref_expr::proto_domain
+ result_domain
, typename unref_expr::proto_tag
, list4<
typename Grammar::proto_child0::template impl< typename result_of::child_c<Expr, 0>::type , State , Data >::result_type , typename Grammar::proto_child1::template impl< typename result_of::child_c<Expr, 1>::type , State , Data >::result_type , typename Grammar::proto_child2::template impl< typename result_of::child_c<Expr, 2>::type , State , Data >::result_type , typename Grammar::proto_child3::template impl< typename result_of::child_c<Expr, 3>::type , State , Data >::result_type
>
>::type
expr_type;
- typedef typename unref_expr::proto_generator proto_generator;
+ typedef typename result_domain::proto_generator proto_generator;
typedef typename BOOST_PROTO_RESULT_OF<proto_generator(expr_type)>::type result_type;
BOOST_FORCEINLINE
- result_type const operator ()(
+ BOOST_PROTO_RETURN_TYPE_STRICT_LOOSE(result_type, result_type const)
+ operator ()(
typename pass_through_impl::expr_param e
, typename pass_through_impl::state_param s
, typename pass_through_impl::data_param d
@@ -139,24 +171,32 @@
return proto_generator()(that);
}
};
- template<typename Grammar, typename Expr, typename State, typename Data>
- struct pass_through_impl<Grammar, Expr, State, Data, 5>
+ template<typename Grammar, typename Domain, typename Expr, typename State, typename Data>
+ struct pass_through_impl<Grammar, Domain, Expr, State, Data, 5>
: transform_impl<Expr, State, Data>
{
typedef typename pass_through_impl::expr unref_expr;
typedef
+ typename mpl::if_c<
+ is_same<Domain, deduce_domain>::value
+ , typename unref_expr::proto_domain
+ , Domain
+ >::type
+ result_domain;
+ typedef
typename base_expr<
- typename unref_expr::proto_domain
+ result_domain
, typename unref_expr::proto_tag
, list5<
typename Grammar::proto_child0::template impl< typename result_of::child_c<Expr, 0>::type , State , Data >::result_type , typename Grammar::proto_child1::template impl< typename result_of::child_c<Expr, 1>::type , State , Data >::result_type , typename Grammar::proto_child2::template impl< typename result_of::child_c<Expr, 2>::type , State , Data >::result_type , typename Grammar::proto_child3::template impl< typename result_of::child_c<Expr, 3>::type , State , Data >::result_type , typename Grammar::proto_child4::template impl< typename result_of::child_c<Expr, 4>::type , State , Data >::result_type
>
>::type
expr_type;
- typedef typename unref_expr::proto_generator proto_generator;
+ typedef typename result_domain::proto_generator proto_generator;
typedef typename BOOST_PROTO_RESULT_OF<proto_generator(expr_type)>::type result_type;
BOOST_FORCEINLINE
- result_type const operator ()(
+ BOOST_PROTO_RETURN_TYPE_STRICT_LOOSE(result_type, result_type const)
+ operator ()(
typename pass_through_impl::expr_param e
, typename pass_through_impl::state_param s
, typename pass_through_impl::data_param d
@@ -172,24 +212,32 @@
return proto_generator()(that);
}
};
- template<typename Grammar, typename Expr, typename State, typename Data>
- struct pass_through_impl<Grammar, Expr, State, Data, 6>
+ template<typename Grammar, typename Domain, typename Expr, typename State, typename Data>
+ struct pass_through_impl<Grammar, Domain, Expr, State, Data, 6>
: transform_impl<Expr, State, Data>
{
typedef typename pass_through_impl::expr unref_expr;
typedef
+ typename mpl::if_c<
+ is_same<Domain, deduce_domain>::value
+ , typename unref_expr::proto_domain
+ , Domain
+ >::type
+ result_domain;
+ typedef
typename base_expr<
- typename unref_expr::proto_domain
+ result_domain
, typename unref_expr::proto_tag
, list6<
typename Grammar::proto_child0::template impl< typename result_of::child_c<Expr, 0>::type , State , Data >::result_type , typename Grammar::proto_child1::template impl< typename result_of::child_c<Expr, 1>::type , State , Data >::result_type , typename Grammar::proto_child2::template impl< typename result_of::child_c<Expr, 2>::type , State , Data >::result_type , typename Grammar::proto_child3::template impl< typename result_of::child_c<Expr, 3>::type , State , Data >::result_type , typename Grammar::proto_child4::template impl< typename result_of::child_c<Expr, 4>::type , State , Data >::result_type , typename Grammar::proto_child5::template impl< typename result_of::child_c<Expr, 5>::type , State , Data >::result_type
>
>::type
expr_type;
- typedef typename unref_expr::proto_generator proto_generator;
+ typedef typename result_domain::proto_generator proto_generator;
typedef typename BOOST_PROTO_RESULT_OF<proto_generator(expr_type)>::type result_type;
BOOST_FORCEINLINE
- result_type const operator ()(
+ BOOST_PROTO_RETURN_TYPE_STRICT_LOOSE(result_type, result_type const)
+ operator ()(
typename pass_through_impl::expr_param e
, typename pass_through_impl::state_param s
, typename pass_through_impl::data_param d
@@ -205,24 +253,32 @@
return proto_generator()(that);
}
};
- template<typename Grammar, typename Expr, typename State, typename Data>
- struct pass_through_impl<Grammar, Expr, State, Data, 7>
+ template<typename Grammar, typename Domain, typename Expr, typename State, typename Data>
+ struct pass_through_impl<Grammar, Domain, Expr, State, Data, 7>
: transform_impl<Expr, State, Data>
{
typedef typename pass_through_impl::expr unref_expr;
typedef
+ typename mpl::if_c<
+ is_same<Domain, deduce_domain>::value
+ , typename unref_expr::proto_domain
+ , Domain
+ >::type
+ result_domain;
+ typedef
typename base_expr<
- typename unref_expr::proto_domain
+ result_domain
, typename unref_expr::proto_tag
, list7<
typename Grammar::proto_child0::template impl< typename result_of::child_c<Expr, 0>::type , State , Data >::result_type , typename Grammar::proto_child1::template impl< typename result_of::child_c<Expr, 1>::type , State , Data >::result_type , typename Grammar::proto_child2::template impl< typename result_of::child_c<Expr, 2>::type , State , Data >::result_type , typename Grammar::proto_child3::template impl< typename result_of::child_c<Expr, 3>::type , State , Data >::result_type , typename Grammar::proto_child4::template impl< typename result_of::child_c<Expr, 4>::type , State , Data >::result_type , typename Grammar::proto_child5::template impl< typename result_of::child_c<Expr, 5>::type , State , Data >::result_type , typename Grammar::proto_child6::template impl< typename result_of::child_c<Expr, 6>::type , State , Data >::result_type
>
>::type
expr_type;
- typedef typename unref_expr::proto_generator proto_generator;
+ typedef typename result_domain::proto_generator proto_generator;
typedef typename BOOST_PROTO_RESULT_OF<proto_generator(expr_type)>::type result_type;
BOOST_FORCEINLINE
- result_type const operator ()(
+ BOOST_PROTO_RETURN_TYPE_STRICT_LOOSE(result_type, result_type const)
+ operator ()(
typename pass_through_impl::expr_param e
, typename pass_through_impl::state_param s
, typename pass_through_impl::data_param d
@@ -238,24 +294,32 @@
return proto_generator()(that);
}
};
- template<typename Grammar, typename Expr, typename State, typename Data>
- struct pass_through_impl<Grammar, Expr, State, Data, 8>
+ template<typename Grammar, typename Domain, typename Expr, typename State, typename Data>
+ struct pass_through_impl<Grammar, Domain, Expr, State, Data, 8>
: transform_impl<Expr, State, Data>
{
typedef typename pass_through_impl::expr unref_expr;
typedef
+ typename mpl::if_c<
+ is_same<Domain, deduce_domain>::value
+ , typename unref_expr::proto_domain
+ , Domain
+ >::type
+ result_domain;
+ typedef
typename base_expr<
- typename unref_expr::proto_domain
+ result_domain
, typename unref_expr::proto_tag
, list8<
typename Grammar::proto_child0::template impl< typename result_of::child_c<Expr, 0>::type , State , Data >::result_type , typename Grammar::proto_child1::template impl< typename result_of::child_c<Expr, 1>::type , State , Data >::result_type , typename Grammar::proto_child2::template impl< typename result_of::child_c<Expr, 2>::type , State , Data >::result_type , typename Grammar::proto_child3::template impl< typename result_of::child_c<Expr, 3>::type , State , Data >::result_type , typename Grammar::proto_child4::template impl< typename result_of::child_c<Expr, 4>::type , State , Data >::result_type , typename Grammar::proto_child5::template impl< typename result_of::child_c<Expr, 5>::type , State , Data >::result_type , typename Grammar::proto_child6::template impl< typename result_of::child_c<Expr, 6>::type , State , Data >::result_type , typename Grammar::proto_child7::template impl< typename result_of::child_c<Expr, 7>::type , State , Data >::result_type
>
>::type
expr_type;
- typedef typename unref_expr::proto_generator proto_generator;
+ typedef typename result_domain::proto_generator proto_generator;
typedef typename BOOST_PROTO_RESULT_OF<proto_generator(expr_type)>::type result_type;
BOOST_FORCEINLINE
- result_type const operator ()(
+ BOOST_PROTO_RETURN_TYPE_STRICT_LOOSE(result_type, result_type const)
+ operator ()(
typename pass_through_impl::expr_param e
, typename pass_through_impl::state_param s
, typename pass_through_impl::data_param d
@@ -271,24 +335,32 @@
return proto_generator()(that);
}
};
- template<typename Grammar, typename Expr, typename State, typename Data>
- struct pass_through_impl<Grammar, Expr, State, Data, 9>
+ template<typename Grammar, typename Domain, typename Expr, typename State, typename Data>
+ struct pass_through_impl<Grammar, Domain, Expr, State, Data, 9>
: transform_impl<Expr, State, Data>
{
typedef typename pass_through_impl::expr unref_expr;
typedef
+ typename mpl::if_c<
+ is_same<Domain, deduce_domain>::value
+ , typename unref_expr::proto_domain
+ , Domain
+ >::type
+ result_domain;
+ typedef
typename base_expr<
- typename unref_expr::proto_domain
+ result_domain
, typename unref_expr::proto_tag
, list9<
typename Grammar::proto_child0::template impl< typename result_of::child_c<Expr, 0>::type , State , Data >::result_type , typename Grammar::proto_child1::template impl< typename result_of::child_c<Expr, 1>::type , State , Data >::result_type , typename Grammar::proto_child2::template impl< typename result_of::child_c<Expr, 2>::type , State , Data >::result_type , typename Grammar::proto_child3::template impl< typename result_of::child_c<Expr, 3>::type , State , Data >::result_type , typename Grammar::proto_child4::template impl< typename result_of::child_c<Expr, 4>::type , State , Data >::result_type , typename Grammar::proto_child5::template impl< typename result_of::child_c<Expr, 5>::type , State , Data >::result_type , typename Grammar::proto_child6::template impl< typename result_of::child_c<Expr, 6>::type , State , Data >::result_type , typename Grammar::proto_child7::template impl< typename result_of::child_c<Expr, 7>::type , State , Data >::result_type , typename Grammar::proto_ch
ild8::template impl< typename result_of::child_c<Expr, 8>::type , State , Data >::result_type
>
>::type
expr_type;
- typedef typename unref_expr::proto_generator proto_generator;
+ typedef typename result_domain::proto_generator proto_generator;
typedef typename BOOST_PROTO_RESULT_OF<proto_generator(expr_type)>::type result_type;
BOOST_FORCEINLINE
- result_type const operator ()(
+ BOOST_PROTO_RETURN_TYPE_STRICT_LOOSE(result_type, result_type const)
+ operator ()(
typename pass_through_impl::expr_param e
, typename pass_through_impl::state_param s
, typename pass_through_impl::data_param d
@@ -304,24 +376,32 @@
return proto_generator()(that);
}
};
- template<typename Grammar, typename Expr, typename State, typename Data>
- struct pass_through_impl<Grammar, Expr, State, Data, 10>
+ template<typename Grammar, typename Domain, typename Expr, typename State, typename Data>
+ struct pass_through_impl<Grammar, Domain, Expr, State, Data, 10>
: transform_impl<Expr, State, Data>
{
typedef typename pass_through_impl::expr unref_expr;
typedef
+ typename mpl::if_c<
+ is_same<Domain, deduce_domain>::value
+ , typename unref_expr::proto_domain
+ , Domain
+ >::type
+ result_domain;
+ typedef
typename base_expr<
- typename unref_expr::proto_domain
+ result_domain
, typename unref_expr::proto_tag
, list10<
typename Grammar::proto_child0::template impl< typename result_of::child_c<Expr, 0>::type , State , Data >::result_type , typename Grammar::proto_child1::template impl< typename result_of::child_c<Expr, 1>::type , State , Data >::result_type , typename Grammar::proto_child2::template impl< typename result_of::child_c<Expr, 2>::type , State , Data >::result_type , typename Grammar::proto_child3::template impl< typename result_of::child_c<Expr, 3>::type , State , Data >::result_type , typename Grammar::proto_child4::template impl< typename result_of::child_c<Expr, 4>::type , State , Data >::result_type , typename Grammar::proto_child5::template impl< typename result_of::child_c<Expr, 5>::type , State , Data >::result_type , typename Grammar::proto_child6::template impl< typename result_of::child_c<Expr, 6>::type , State , Data >::result_type , typename Grammar::proto_child7::template impl< typename result_of::child_c<Expr, 7>::type , State , Data >::result_type , typename Grammar::proto_ch
ild8::template impl< typename result_of::child_c<Expr, 8>::type , State , Data >::result_type , typename Grammar::proto_child9::template impl< typename result_of::child_c<Expr, 9>::type , State , Data >::result_type
>
>::type
expr_type;
- typedef typename unref_expr::proto_generator proto_generator;
+ typedef typename result_domain::proto_generator proto_generator;
typedef typename BOOST_PROTO_RESULT_OF<proto_generator(expr_type)>::type result_type;
BOOST_FORCEINLINE
- result_type const operator ()(
+ BOOST_PROTO_RETURN_TYPE_STRICT_LOOSE(result_type, result_type const)
+ operator ()(
typename pass_through_impl::expr_param e
, typename pass_through_impl::state_param s
, typename pass_through_impl::data_param d
Modified: branches/release/boost/proto/transform/env.hpp
==============================================================================
--- branches/release/boost/proto/transform/env.hpp (original)
+++ branches/release/boost/proto/transform/env.hpp 2012-09-18 13:00:48 EDT (Tue, 18 Sep 2012)
@@ -455,11 +455,7 @@
typedef typename impl::data::template lookup<Key>::type result_type;
BOOST_MPL_ASSERT_NOT((is_same<result_type, key_not_found>)); // lookup failed
- #ifdef BOOST_PROTO_STRICT_RESULT_OF
- result_type
- #else
- typename impl::data::template lookup<Key>::const_reference
- #endif
+ BOOST_PROTO_RETURN_TYPE_STRICT_LOOSE(result_type, typename impl::data::template lookup<Key>::const_reference)
operator ()(
typename impl::expr_param
, typename impl::state_param
@@ -480,11 +476,7 @@
{
typedef Data result_type;
- #ifdef BOOST_PROTO_STRICT_RESULT_OF
- result_type
- #else
- typename impl::data_param
- #endif
+ BOOST_PROTO_RETURN_TYPE_STRICT_LOOSE(result_type, typename impl::data_param)
operator ()(
typename impl::expr_param
, typename impl::state_param
Modified: branches/release/boost/proto/transform/pass_through.hpp
==============================================================================
--- branches/release/boost/proto/transform/pass_through.hpp (original)
+++ branches/release/boost/proto/transform/pass_through.hpp 2012-09-18 13:00:48 EDT (Tue, 18 Sep 2012)
@@ -16,6 +16,8 @@
#include <boost/preprocessor/repetition/enum.hpp>
#include <boost/preprocessor/iteration/iterate.hpp>
#include <boost/mpl/bool.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_reference.hpp>
#include <boost/proto/proto_fwd.hpp>
#include <boost/proto/args.hpp>
@@ -33,6 +35,7 @@
{
template<
typename Grammar
+ , typename Domain
, typename Expr
, typename State
, typename Data
@@ -43,8 +46,8 @@
#include <boost/proto/transform/detail/pass_through_impl.hpp>
- template<typename Grammar, typename Expr, typename State, typename Data>
- struct pass_through_impl<Grammar, Expr, State, Data, 0>
+ template<typename Grammar, typename Domain, typename Expr, typename State, typename Data>
+ struct pass_through_impl<Grammar, Domain, Expr, State, Data, 0>
: transform_impl<Expr, State, Data>
{
typedef Expr result_type;
@@ -53,11 +56,7 @@
/// \return \c e
/// \throw nothrow
BOOST_FORCEINLINE
- #ifdef BOOST_PROTO_STRICT_RESULT_OF
- result_type
- #else
- typename pass_through_impl::expr_param
- #endif
+ BOOST_PROTO_RETURN_TYPE_STRICT_LOOSE(result_type, typename pass_through_impl::expr_param)
operator()(
typename pass_through_impl::expr_param e
, typename pass_through_impl::state_param
@@ -120,20 +119,20 @@
/// >
/// {};
/// \endcode
- template<typename Grammar>
+ template<typename Grammar, typename Domain /* = deduce_domain*/>
struct pass_through
- : transform<pass_through<Grammar> >
+ : transform<pass_through<Grammar, Domain> >
{
template<typename Expr, typename State, typename Data>
struct impl
- : detail::pass_through_impl<Grammar, Expr, State, Data>
+ : detail::pass_through_impl<Grammar, Domain, Expr, State, Data>
{};
};
/// INTERNAL ONLY
///
- template<typename Grammar>
- struct is_callable<pass_through<Grammar> >
+ template<typename Grammar, typename Domain>
+ struct is_callable<pass_through<Grammar, Domain> >
: mpl::true_
{};
Modified: branches/release/libs/proto/doc/reference/transform/pass_through.xml
==============================================================================
--- branches/release/libs/proto/doc/reference/transform/pass_through.xml (original)
+++ branches/release/libs/proto/doc/reference/transform/pass_through.xml 2012-09-18 13:00:48 EDT (Tue, 18 Sep 2012)
@@ -18,10 +18,13 @@
<struct name="pass_through">
<template>
<template-type-parameter name="Grammar"/>
+ <template-type-parameter name="Domain">
+ <default><classname>proto::deduce_domain</classname></default>
+ </template-type-parameter>
</template>
- <inherit><type><classname>proto::transform</classname>< pass_through<Grammar> ></type></inherit>
+ <inherit><type><classname>proto::transform</classname>< pass_through<Grammar, Domain> ></type></inherit>
<purpose>A <conceptname>PrimitiveTransform</conceptname> that transforms the child expressions of an expression
- node according to the corresponding children of a Grammar.</purpose>
+ node according to the corresponding children of a Grammar. The resulting expression is in the specified domain.</purpose>
<description>
<para>
Given a Grammar such as <computeroutput><classname>proto::plus</classname><T0, T1></computeroutput>,
@@ -39,6 +42,13 @@
results are reassembled into a new expression node with the same tag type as the original.
</para>
<para>
+ The <code>Domain</code> template parameter determines which domain the resulting expression should
+ be in. If it is <code><classname>proto::deduce_domain</classname></code>, which is the default,
+ the resulting expression is in the same domain as the expression passed in. Otherwise, the resulting
+ expression is in the specified domain. Practically, that means the specified domain's generator is
+ used to post-process the resulting expression.
+ </para>
+ <para>
The explicit use of <computeroutput>proto::pass_through<></computeroutput> is not usually
needed, since the expression generator metafunctions such as
<computeroutput><classname>proto::plus</classname><></computeroutput> have
@@ -107,10 +117,18 @@
<purpose>For exposition only</purpose>
<type>typename Expr::proto_tag</type>
</typedef>
- <typedef name="D">
+ <typedef name="Deduce">
+ <purpose>For exposition only</purpose>
+ <type>boost::is_same<Domain, <classname>deduce_domain</classname>></type>
+ </typedef>
+ <typedef name="DD">
<purpose>For exposition only</purpose>
<type>typename Expr::proto_domain</type>
</typedef>
+ <typedef name="D">
+ <purpose>For exposition only</purpose>
+ <type>typename mpl::if_<Deduce, DD, Domain>::type</type>
+ </typedef>
<typedef name="G">
<purpose>For exposition only</purpose>
<type>typename D::proto_generator</type>
Modified: branches/release/libs/proto/preprocess/wave.cfg
==============================================================================
--- branches/release/libs/proto/preprocess/wave.cfg (original)
+++ branches/release/libs/proto/preprocess/wave.cfg 2012-09-18 13:00:48 EDT (Tue, 18 Sep 2012)
@@ -7,6 +7,7 @@
-DBOOST_PROTO_DONT_USE_PREPROCESSED_FILES
-DBOOST_PROTO_CREATE_PREPROCESSED_FILES
-D_WIN32
+-NBOOST_PROTO_RETURN_TYPE_STRICT_LOOSE
-NBOOST_FORCEINLINE
-NBOOST_MPL_ASSERT
-NBOOST_MPL_ASSERT_MSG
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk