Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r62138 - in branches/release: . boost boost/algorithm/string boost/archive boost/bimap boost/config boost/config/compiler boost/detail boost/filesystem boost/functional/hash boost/fusion boost/gil boost/graph boost/integer boost/interprocess boost/intrusive boost/iostreams boost/numeric/ublas boost/program_options boost/property_tree boost/proto boost/proto/context boost/proto/transform boost/python boost/range boost/regex boost/serialization boost/signals boost/signals2 boost/spirit boost/spirit/home boost/spirit/home/karma boost/spirit/home/support boost/statechart boost/system boost/thread boost/tr1 boost/type_traits boost/unordered boost/utility boost/uuid boost/variant boost/wave doc libs libs/array/doc libs/array/test libs/bimap libs/config libs/config/doc libs/filesystem libs/functional/hash libs/fusion libs/graph_parallel libs/integer libs/interprocess libs/intrusive libs/iostreams libs/mpl/doc/refmanual libs/mpl/doc/src/refmanual libs/numeric/ublas libs/numeric/ublas/doc libs/property_tree libs/proto/doc libs/proto/doc/reference libs/proto/doc/reference/transform libs/python libs/range libs/range/doc libs/regex libs/regex/doc libs/serialization libs/signals libs/signals2 libs/spirit libs/spirit/classic/example libs/spirit/doc libs/spirit/example libs/spirit/phoenix libs/spirit/test libs/spirit/test/qi libs/statechart libs/static_assert libs/system libs/thread libs/timer libs/tr1 libs/type_traits libs/unordered libs/utility libs/utility/swap/test libs/uuid libs/wave more people status tools tools/bcp tools/boostbook tools/build/v2 tools/build/v2/tools tools/inspect tools/jam tools/quickbook tools/regression tools/release tools/wave wiki
From: eric_at_[hidden]
Date: 2010-05-22 02:17:58


Author: eric_niebler
Date: 2010-05-22 02:17:55 EDT (Sat, 22 May 2010)
New Revision: 62138
URL: http://svn.boost.org/trac/boost/changeset/62138

Log:
Merged revisions 61076,61547,61675-61677,61750,61782,61788,61859 via svnmerge from
https://svn.boost.org/svn/boost/trunk

........
  r61076 | eric_niebler | 2010-04-05 12:15:49 -0700 (Mon, 05 Apr 2010) | 1 line
  
  code clean-up
........
  r61547 | eric_niebler | 2010-04-24 12:50:15 -0700 (Sat, 24 Apr 2010) | 1 line
  
  when using proto::and_ as a transform, apply *all* transforms but only return the result of applying the last
........
  r61675 | eric_niebler | 2010-04-29 06:59:12 -0700 (Thu, 29 Apr 2010) | 1 line
  
  allow virtual members to be in a different domain than their enclosing class
........
  r61676 | eric_niebler | 2010-04-29 08:08:18 -0700 (Thu, 29 Apr 2010) | 1 line
  
  const-correctness fixes when invoking proto domains
........
  r61677 | eric_niebler | 2010-04-29 08:18:21 -0700 (Thu, 29 Apr 2010) | 1 line
  
  more const-correctness fixes when invoking proto domains
........
  r61750 | eric_niebler | 2010-05-03 18:19:53 -0700 (Mon, 03 May 2010) | 1 line
  
  _default transform is also a grammar that matches the expressions the transform knows how to handle
........
  r61782 | eric_niebler | 2010-05-04 17:19:22 -0700 (Tue, 04 May 2010) | 1 line
  
  pass_through transform doesn't strip expression wrappers
........
  r61788 | eric_niebler | 2010-05-05 09:02:34 -0700 (Wed, 05 May 2010) | 1 line
  
  fix broken proto
........
  r61859 | eric_niebler | 2010-05-08 15:27:39 -0700 (Sat, 08 May 2010) | 1 line
  
  add partial support for sub-domains. Full support (on compilers supporting Boost.TypeOf) to come
........

Properties modified:
   branches/release/ (props changed)
   branches/release/INSTALL (props changed)
   branches/release/LICENSE_1_0.txt (props changed)
   branches/release/boost/ (props changed)
   branches/release/boost-build.jam (props changed)
   branches/release/boost.css (props changed)
   branches/release/boost.png (props changed)
   branches/release/boost/algorithm/string/ (props changed)
   branches/release/boost/archive/ (props changed)
   branches/release/boost/array.hpp (props changed)
   branches/release/boost/bimap/ (props changed)
   branches/release/boost/config/ (props changed)
   branches/release/boost/config/compiler/ (props changed)
   branches/release/boost/detail/ (props changed)
   branches/release/boost/filesystem/ (props changed)
   branches/release/boost/functional/hash/ (props changed)
   branches/release/boost/fusion/ (props changed)
   branches/release/boost/gil/ (props changed)
   branches/release/boost/graph/ (props changed)
   branches/release/boost/integer/ (props changed)
   branches/release/boost/interprocess/ (props changed)
   branches/release/boost/intrusive/ (props changed)
   branches/release/boost/iostreams/ (props changed)
   branches/release/boost/numeric/ublas/ (props changed)
   branches/release/boost/program_options/ (props changed)
   branches/release/boost/property_tree/ (props changed)
   branches/release/boost/python/ (props changed)
   branches/release/boost/range/ (props changed)
   branches/release/boost/regex/ (props changed)
   branches/release/boost/serialization/ (props changed)
   branches/release/boost/serialization/factory.hpp (props changed)
   branches/release/boost/signals/ (props changed)
   branches/release/boost/signals2/ (props changed)
   branches/release/boost/spirit/ (props changed)
   branches/release/boost/spirit/home/ (props changed)
   branches/release/boost/spirit/home/karma/ (props changed)
   branches/release/boost/spirit/home/support/attributes.hpp (props changed)
   branches/release/boost/statechart/ (props changed)
   branches/release/boost/system/ (props changed)
   branches/release/boost/thread/ (props changed)
   branches/release/boost/thread.hpp (props changed)
   branches/release/boost/tr1/ (props changed)
   branches/release/boost/type_traits/ (props changed)
   branches/release/boost/unordered/ (props changed)
   branches/release/boost/utility/ (props changed)
   branches/release/boost/utility/value_init.hpp (props changed)
   branches/release/boost/uuid/ (props changed)
   branches/release/boost/variant/ (props changed)
   branches/release/boost/wave/ (props changed)
   branches/release/bootstrap.bat (props changed)
   branches/release/bootstrap.sh (props changed)
   branches/release/doc/ (props changed)
   branches/release/index.htm (props changed)
   branches/release/libs/ (props changed)
   branches/release/libs/array/doc/array.xml (props changed)
   branches/release/libs/array/test/array0.cpp (props changed)
   branches/release/libs/bimap/ (props changed)
   branches/release/libs/config/ (props changed)
   branches/release/libs/config/doc/ (props changed)
   branches/release/libs/filesystem/ (props changed)
   branches/release/libs/functional/hash/ (props changed)
   branches/release/libs/fusion/ (props changed)
   branches/release/libs/graph_parallel/ (props changed)
   branches/release/libs/integer/ (props changed)
   branches/release/libs/interprocess/ (props changed)
   branches/release/libs/intrusive/ (props changed)
   branches/release/libs/iostreams/ (props changed)
   branches/release/libs/libraries.htm (props changed)
   branches/release/libs/maintainers.txt (props changed)
   branches/release/libs/mpl/doc/refmanual/broken-compiler-workarounds.html (props changed)
   branches/release/libs/mpl/doc/refmanual/categorized-index-concepts.html (props changed)
   branches/release/libs/mpl/doc/refmanual/cfg-no-preprocessed-headers.html (props changed)
   branches/release/libs/mpl/doc/refmanual/composition-and-argument-binding.html (props changed)
   branches/release/libs/mpl/doc/refmanual/data-types-concepts.html (props changed)
   branches/release/libs/mpl/doc/refmanual/data-types-miscellaneous.html (props changed)
   branches/release/libs/mpl/doc/refmanual/extensible-associative-sequence.html (props changed)
   branches/release/libs/mpl/doc/refmanual/inserter-class.html (props changed)
   branches/release/libs/mpl/doc/refmanual/tag-dispatched-metafunction.html (props changed)
   branches/release/libs/mpl/doc/refmanual/trivial-metafunctions-summary.html (props changed)
   branches/release/libs/mpl/doc/src/refmanual/Iterators-Iterator.rst (props changed)
   branches/release/libs/numeric/ublas/ (props changed)
   branches/release/libs/numeric/ublas/doc/ (props changed)
   branches/release/libs/property_tree/ (props changed)
   branches/release/libs/python/ (props changed)
   branches/release/libs/range/ (props changed)
   branches/release/libs/range/doc/ (props changed)
   branches/release/libs/regex/ (props changed)
   branches/release/libs/regex/doc/ (props changed)
   branches/release/libs/serialization/ (props changed)
   branches/release/libs/signals/ (props changed)
   branches/release/libs/signals2/ (props changed)
   branches/release/libs/spirit/ (props changed)
   branches/release/libs/spirit/classic/example/ (props changed)
   branches/release/libs/spirit/doc/ (props changed)
   branches/release/libs/spirit/example/ (props changed)
   branches/release/libs/spirit/phoenix/ (props changed)
   branches/release/libs/spirit/test/ (props changed)
   branches/release/libs/spirit/test/qi/optional.cpp (props changed)
   branches/release/libs/statechart/ (props changed)
   branches/release/libs/static_assert/ (props changed)
   branches/release/libs/system/ (props changed)
   branches/release/libs/thread/ (props changed)
   branches/release/libs/timer/ (props changed)
   branches/release/libs/tr1/ (props changed)
   branches/release/libs/type_traits/ (props changed)
   branches/release/libs/unordered/ (props changed)
   branches/release/libs/utility/ (props changed)
   branches/release/libs/utility/swap.html (props changed)
   branches/release/libs/utility/swap/test/std_bitset.cpp (props changed)
   branches/release/libs/utility/value_init.htm (props changed)
   branches/release/libs/utility/value_init_test.cpp (props changed)
   branches/release/libs/uuid/ (props changed)
   branches/release/libs/wave/ (props changed)
   branches/release/more/ (props changed)
   branches/release/people/ (props changed)
   branches/release/rst.css (props changed)
   branches/release/status/ (props changed)
   branches/release/status/Jamfile.v2 (props changed)
   branches/release/tools/ (props changed)
   branches/release/tools/bcp/ (props changed)
   branches/release/tools/boostbook/ (props changed)
   branches/release/tools/build/v2/ (props changed)
   branches/release/tools/build/v2/tools/ (props changed)
   branches/release/tools/inspect/ (props changed)
   branches/release/tools/jam/ (props changed)
   branches/release/tools/quickbook/ (props changed)
   branches/release/tools/regression/ (props changed)
   branches/release/tools/release/ (props changed)
   branches/release/tools/wave/ (props changed)
   branches/release/wiki/ (props changed)
Text files modified:
   branches/release/boost/proto/context/default.hpp | 172 +++++----
   branches/release/boost/proto/deep_copy.hpp | 2
   branches/release/boost/proto/domain.hpp | 449 ++++++++++++++++---------
   branches/release/boost/proto/extends.hpp | 124 ++-----
   branches/release/boost/proto/make_expr.hpp | 104 -----
   branches/release/boost/proto/matches.hpp | 77 ++-
   branches/release/boost/proto/operators.hpp | 44 -
   branches/release/boost/proto/proto_fwd.hpp | 12
   branches/release/boost/proto/proto_typeof.hpp | 5
   branches/release/boost/proto/transform/arg.hpp | 19 +
   branches/release/boost/proto/transform/default.hpp | 693 +++++++++++++++++++++++----------------
   branches/release/boost/proto/transform/pass_through.hpp | 25
   branches/release/libs/proto/doc/back_end.qbk | 4
   branches/release/libs/proto/doc/reference.xml | 5
   branches/release/libs/proto/doc/reference/matches.xml | 6
   branches/release/libs/proto/doc/reference/transform/arg.xml | 38 ++
   branches/release/libs/proto/doc/reference/transform/pass_through.xml | 14
   branches/release/libs/proto/doc/release_notes.qbk | 15
   18 files changed, 1022 insertions(+), 786 deletions(-)

Modified: branches/release/boost/proto/context/default.hpp
==============================================================================
--- branches/release/boost/proto/context/default.hpp (original)
+++ branches/release/boost/proto/context/default.hpp 2010-05-22 02:17:55 EDT (Sat, 22 May 2010)
@@ -13,7 +13,10 @@
     #define BOOST_PROTO_CONTEXT_DEFAULT_HPP_EAN_01_08_2007
 
     #include <boost/config.hpp>
+ #include <boost/preprocessor/arithmetic/add.hpp>
+ #include <boost/preprocessor/arithmetic/sub.hpp>
     #include <boost/preprocessor/iteration/iterate.hpp>
+ #include <boost/preprocessor/repetition/enum.hpp>
     #include <boost/preprocessor/repetition/enum_shifted.hpp>
     #include <boost/utility/result_of.hpp>
     #include <boost/type_traits/is_const.hpp>
@@ -45,9 +48,22 @@
             struct default_eval
             {};
 
+ template<typename Expr, typename Context>
+ struct default_eval<Expr, Context, tag::terminal, 0>
+ {
+ typedef
+ typename proto::result_of::value<Expr &>::type
+ result_type;
+
+ result_type operator ()(Expr &expr, Context &) const
+ {
+ return proto::value(expr);
+ }
+ };
+
             /// INTERNAL ONLY
             ///
- #define BOOST_PROTO_UNARY_OP_RESULT(OP, TAG, MAKE) \
+ #define BOOST_PROTO_UNARY_DEFAULT_EVAL(OP, TAG, MAKE) \
             template<typename Expr, typename Context> \
             struct default_eval<Expr, Context, TAG, 1> \
             { \
@@ -65,7 +81,7 @@
 
             /// INTERNAL ONLY
             ///
- #define BOOST_PROTO_BINARY_OP_RESULT(OP, TAG, LMAKE, RMAKE) \
+ #define BOOST_PROTO_BINARY_DEFAULT_EVAL(OP, TAG, LMAKE, RMAKE) \
             template<typename Expr, typename Context> \
             struct default_eval<Expr, Context, TAG, 2> \
             { \
@@ -89,48 +105,48 @@
             }; \
             /**/
 
- BOOST_PROTO_UNARY_OP_RESULT(+, proto::tag::unary_plus, make)
- BOOST_PROTO_UNARY_OP_RESULT(-, proto::tag::negate, make)
- BOOST_PROTO_UNARY_OP_RESULT(*, proto::tag::dereference, make)
- BOOST_PROTO_UNARY_OP_RESULT(~, proto::tag::complement, make)
- BOOST_PROTO_UNARY_OP_RESULT(&, proto::tag::address_of, make)
- BOOST_PROTO_UNARY_OP_RESULT(!, proto::tag::logical_not, make)
- BOOST_PROTO_UNARY_OP_RESULT(++, proto::tag::pre_inc, make_mutable)
- BOOST_PROTO_UNARY_OP_RESULT(--, proto::tag::pre_dec, make_mutable)
-
- BOOST_PROTO_BINARY_OP_RESULT(<<, proto::tag::shift_left, make_mutable, make)
- BOOST_PROTO_BINARY_OP_RESULT(>>, proto::tag::shift_right, make_mutable, make)
- BOOST_PROTO_BINARY_OP_RESULT(*, proto::tag::multiplies, make, make)
- BOOST_PROTO_BINARY_OP_RESULT(/, proto::tag::divides, make, make)
- BOOST_PROTO_BINARY_OP_RESULT(%, proto::tag::modulus, make, make)
- BOOST_PROTO_BINARY_OP_RESULT(+, proto::tag::plus, make, make)
- BOOST_PROTO_BINARY_OP_RESULT(-, proto::tag::minus, make, make)
- BOOST_PROTO_BINARY_OP_RESULT(<, proto::tag::less, make, make)
- BOOST_PROTO_BINARY_OP_RESULT(>, proto::tag::greater, make, make)
- BOOST_PROTO_BINARY_OP_RESULT(<=, proto::tag::less_equal, make, make)
- BOOST_PROTO_BINARY_OP_RESULT(>=, proto::tag::greater_equal, make, make)
- BOOST_PROTO_BINARY_OP_RESULT(==, proto::tag::equal_to, make, make)
- BOOST_PROTO_BINARY_OP_RESULT(!=, proto::tag::not_equal_to, make, make)
- BOOST_PROTO_BINARY_OP_RESULT(||, proto::tag::logical_or, make, make)
- BOOST_PROTO_BINARY_OP_RESULT(&&, proto::tag::logical_and, make, make)
- BOOST_PROTO_BINARY_OP_RESULT(&, proto::tag::bitwise_and, make, make)
- BOOST_PROTO_BINARY_OP_RESULT(|, proto::tag::bitwise_or, make, make)
- BOOST_PROTO_BINARY_OP_RESULT(^, proto::tag::bitwise_xor, make, make)
-
- BOOST_PROTO_BINARY_OP_RESULT(=, proto::tag::assign, make_mutable, make)
- BOOST_PROTO_BINARY_OP_RESULT(<<=, proto::tag::shift_left_assign, make_mutable, make)
- BOOST_PROTO_BINARY_OP_RESULT(>>=, proto::tag::shift_right_assign, make_mutable, make)
- BOOST_PROTO_BINARY_OP_RESULT(*=, proto::tag::multiplies_assign, make_mutable, make)
- BOOST_PROTO_BINARY_OP_RESULT(/=, proto::tag::divides_assign, make_mutable, make)
- BOOST_PROTO_BINARY_OP_RESULT(%=, proto::tag::modulus_assign, make_mutable, make)
- BOOST_PROTO_BINARY_OP_RESULT(+=, proto::tag::plus_assign, make_mutable, make)
- BOOST_PROTO_BINARY_OP_RESULT(-=, proto::tag::minus_assign, make_mutable, make)
- BOOST_PROTO_BINARY_OP_RESULT(&=, proto::tag::bitwise_and_assign, make_mutable, make)
- BOOST_PROTO_BINARY_OP_RESULT(|=, proto::tag::bitwise_or_assign, make_mutable, make)
- BOOST_PROTO_BINARY_OP_RESULT(^=, proto::tag::bitwise_xor_assign, make_mutable, make)
+ BOOST_PROTO_UNARY_DEFAULT_EVAL(+, proto::tag::unary_plus, make)
+ BOOST_PROTO_UNARY_DEFAULT_EVAL(-, proto::tag::negate, make)
+ BOOST_PROTO_UNARY_DEFAULT_EVAL(*, proto::tag::dereference, make)
+ BOOST_PROTO_UNARY_DEFAULT_EVAL(~, proto::tag::complement, make)
+ BOOST_PROTO_UNARY_DEFAULT_EVAL(&, proto::tag::address_of, make)
+ BOOST_PROTO_UNARY_DEFAULT_EVAL(!, proto::tag::logical_not, make)
+ BOOST_PROTO_UNARY_DEFAULT_EVAL(++, proto::tag::pre_inc, make_mutable)
+ BOOST_PROTO_UNARY_DEFAULT_EVAL(--, proto::tag::pre_dec, make_mutable)
+
+ BOOST_PROTO_BINARY_DEFAULT_EVAL(<<, proto::tag::shift_left, make_mutable, make)
+ BOOST_PROTO_BINARY_DEFAULT_EVAL(>>, proto::tag::shift_right, make_mutable, make)
+ BOOST_PROTO_BINARY_DEFAULT_EVAL(*, proto::tag::multiplies, make, make)
+ BOOST_PROTO_BINARY_DEFAULT_EVAL(/, proto::tag::divides, make, make)
+ BOOST_PROTO_BINARY_DEFAULT_EVAL(%, proto::tag::modulus, make, make)
+ BOOST_PROTO_BINARY_DEFAULT_EVAL(+, proto::tag::plus, make, make)
+ BOOST_PROTO_BINARY_DEFAULT_EVAL(-, proto::tag::minus, make, make)
+ BOOST_PROTO_BINARY_DEFAULT_EVAL(<, proto::tag::less, make, make)
+ BOOST_PROTO_BINARY_DEFAULT_EVAL(>, proto::tag::greater, make, make)
+ BOOST_PROTO_BINARY_DEFAULT_EVAL(<=, proto::tag::less_equal, make, make)
+ BOOST_PROTO_BINARY_DEFAULT_EVAL(>=, proto::tag::greater_equal, make, make)
+ BOOST_PROTO_BINARY_DEFAULT_EVAL(==, proto::tag::equal_to, make, make)
+ BOOST_PROTO_BINARY_DEFAULT_EVAL(!=, proto::tag::not_equal_to, make, make)
+ BOOST_PROTO_BINARY_DEFAULT_EVAL(||, proto::tag::logical_or, make, make)
+ BOOST_PROTO_BINARY_DEFAULT_EVAL(&&, proto::tag::logical_and, make, make)
+ BOOST_PROTO_BINARY_DEFAULT_EVAL(&, proto::tag::bitwise_and, make, make)
+ BOOST_PROTO_BINARY_DEFAULT_EVAL(|, proto::tag::bitwise_or, make, make)
+ BOOST_PROTO_BINARY_DEFAULT_EVAL(^, proto::tag::bitwise_xor, make, make)
+
+ BOOST_PROTO_BINARY_DEFAULT_EVAL(=, proto::tag::assign, make_mutable, make)
+ BOOST_PROTO_BINARY_DEFAULT_EVAL(<<=, proto::tag::shift_left_assign, make_mutable, make)
+ BOOST_PROTO_BINARY_DEFAULT_EVAL(>>=, proto::tag::shift_right_assign, make_mutable, make)
+ BOOST_PROTO_BINARY_DEFAULT_EVAL(*=, proto::tag::multiplies_assign, make_mutable, make)
+ BOOST_PROTO_BINARY_DEFAULT_EVAL(/=, proto::tag::divides_assign, make_mutable, make)
+ BOOST_PROTO_BINARY_DEFAULT_EVAL(%=, proto::tag::modulus_assign, make_mutable, make)
+ BOOST_PROTO_BINARY_DEFAULT_EVAL(+=, proto::tag::plus_assign, make_mutable, make)
+ BOOST_PROTO_BINARY_DEFAULT_EVAL(-=, proto::tag::minus_assign, make_mutable, make)
+ BOOST_PROTO_BINARY_DEFAULT_EVAL(&=, proto::tag::bitwise_and_assign, make_mutable, make)
+ BOOST_PROTO_BINARY_DEFAULT_EVAL(|=, proto::tag::bitwise_or_assign, make_mutable, make)
+ BOOST_PROTO_BINARY_DEFAULT_EVAL(^=, proto::tag::bitwise_xor_assign, make_mutable, make)
 
- #undef BOOST_PROTO_UNARY_OP_RESULT
- #undef BOOST_PROTO_BINARY_OP_RESULT
+ #undef BOOST_PROTO_UNARY_DEFAULT_EVAL
+ #undef BOOST_PROTO_BINARY_DEFAULT_EVAL
 
             /// INTERNAL ONLY
             template<typename Expr, typename Context>
@@ -194,19 +210,6 @@
               : memfun_eval<Expr, Context, is_member_function_eval<Expr, Context>::value>
             {};
 
- template<typename Expr, typename Context, typename Tag>
- struct default_eval<Expr, Context, Tag, 0>
- {
- typedef
- typename proto::result_of::value<Expr &>::type
- result_type;
-
- result_type operator ()(Expr &expr, Context &) const
- {
- return proto::value(expr);
- }
- };
-
             // Handle post-increment specially.
             template<typename Expr, typename Context>
             struct default_eval<Expr, Context, proto::tag::post_inc, 1>
@@ -298,7 +301,7 @@
             };
 
             // Handle function specially
- #define EVAL_TYPE(Z, N, DATA) \
+ #define BOOST_PROTO_DEFAULT_EVAL_TYPE(Z, N, DATA) \
                 typename proto::result_of::eval< \
                     typename remove_reference< \
                         typename proto::result_of::child_c<DATA, N>::type \
@@ -307,7 +310,7 @@
>::type \
                 /**/
 
- #define EVAL(Z, N, DATA) \
+ #define BOOST_PROTO_DEFAULT_EVAL(Z, N, DATA) \
                 proto::eval(proto::child_c<N>(DATA), context) \
                 /**/
 
@@ -315,7 +318,9 @@
             struct default_eval<Expr, Context, proto::tag::function, 1>
             {
                 typedef
- typename proto::detail::result_of_fixup<EVAL_TYPE(~, 0, Expr)>::type
+ typename proto::detail::result_of_fixup<
+ BOOST_PROTO_DEFAULT_EVAL_TYPE(~, 0, Expr)
+ >::type
                 function_type;
 
                 typedef
@@ -324,7 +329,7 @@
 
                 result_type operator ()(Expr &expr, Context &context) const
                 {
- return EVAL(~, 0, expr)();
+ return BOOST_PROTO_DEFAULT_EVAL(~, 0, expr)();
                 }
             };
 
@@ -332,11 +337,15 @@
             struct default_eval<Expr, Context, proto::tag::function, 2>
             {
                 typedef
- typename proto::detail::result_of_fixup<EVAL_TYPE(~, 0, Expr)>::type
+ typename proto::detail::result_of_fixup<
+ BOOST_PROTO_DEFAULT_EVAL_TYPE(~, 0, Expr)
+ >::type
                 function_type;
 
                 typedef
- typename detail::result_of_<function_type(EVAL_TYPE(~, 1, Expr))>::type
+ typename detail::result_of_<
+ function_type(BOOST_PROTO_DEFAULT_EVAL_TYPE(~, 1, Expr))
+ >::type
                 result_type;
 
                 result_type operator ()(Expr &expr, Context &context) const
@@ -352,29 +361,35 @@
             private:
                 result_type invoke(Expr &expr, Context &context, mpl::false_, mpl::false_) const
                 {
- return EVAL(~, 0, expr)(EVAL(~, 1, expr));
+ return BOOST_PROTO_DEFAULT_EVAL(~, 0, expr)(BOOST_PROTO_DEFAULT_EVAL(~, 1, expr));
                 }
 
                 result_type invoke(Expr &expr, Context &context, mpl::true_, mpl::false_) const
                 {
                     BOOST_PROTO_USE_GET_POINTER();
                     typedef typename detail::classtypeof<function_type>::type class_type;
- return (BOOST_PROTO_GET_POINTER(class_type, EVAL(~, 1, expr)) ->* EVAL(~, 0, expr))();
+ return (
+ BOOST_PROTO_GET_POINTER(class_type, BOOST_PROTO_DEFAULT_EVAL(~, 1, expr)) ->*
+ BOOST_PROTO_DEFAULT_EVAL(~, 0, expr)
+ )();
                 }
 
                 result_type invoke(Expr &expr, Context &context, mpl::false_, mpl::true_) const
                 {
                     BOOST_PROTO_USE_GET_POINTER();
                     typedef typename detail::classtypeof<function_type>::type class_type;
- return (BOOST_PROTO_GET_POINTER(class_type, EVAL(~, 1, expr)) ->* EVAL(~, 0, expr));
+ return (
+ BOOST_PROTO_GET_POINTER(class_type, BOOST_PROTO_DEFAULT_EVAL(~, 1, expr)) ->*
+ BOOST_PROTO_DEFAULT_EVAL(~, 0, expr)
+ );
                 }
             };
 
             #define BOOST_PP_ITERATION_PARAMS_1 (3, (3, BOOST_PROTO_MAX_ARITY, <boost/proto/context/default.hpp>))
             #include BOOST_PP_ITERATE()
 
- #undef EVAL_TYPE
- #undef EVAL
+ #undef BOOST_PROTO_DEFAULT_EVAL_TYPE
+ #undef BOOST_PROTO_DEFAULT_EVAL
 
             /// default_context
             ///
@@ -404,12 +419,14 @@
         struct default_eval<Expr, Context, proto::tag::function, N>
         {
             typedef
- typename proto::detail::result_of_fixup<EVAL_TYPE(~, 0, Expr)>::type
+ typename proto::detail::result_of_fixup<
+ BOOST_PROTO_DEFAULT_EVAL_TYPE(~, 0, Expr)
+ >::type
             function_type;
 
             typedef
                 typename boost::result_of<
- function_type(BOOST_PP_ENUM_SHIFTED(N, EVAL_TYPE, Expr))
+ function_type(BOOST_PP_ENUM_SHIFTED(N, BOOST_PROTO_DEFAULT_EVAL_TYPE, Expr))
>::type
             result_type;
 
@@ -421,17 +438,24 @@
         private:
             result_type invoke(Expr &expr, Context &context, mpl::false_) const
             {
- return EVAL(~, 0, expr)(BOOST_PP_ENUM_SHIFTED(N, EVAL, expr));
+ return BOOST_PROTO_DEFAULT_EVAL(~, 0, expr)(
+ BOOST_PP_ENUM_SHIFTED(N, BOOST_PROTO_DEFAULT_EVAL, expr)
+ );
             }
 
             result_type invoke(Expr &expr, Context &context, mpl::true_) const
             {
- #define M0(Z, M, expr) BOOST_PP_COMMA_IF(BOOST_PP_SUB(M, 2)) EVAL(Z, M, expr)
+ #define M0(Z, M, DATA) \
+ BOOST_PROTO_DEFAULT_EVAL(Z, BOOST_PP_ADD(M, 2), DATA) \
+ /**/
+
                 BOOST_PROTO_USE_GET_POINTER();
                 typedef typename detail::classtypeof<function_type>::type class_type;
- return (BOOST_PROTO_GET_POINTER(class_type, EVAL(~, 1, expr)) ->* EVAL(~, 0, expr))(
- BOOST_PP_REPEAT_FROM_TO(2, N, M0, expr)
- );
+ return (
+ BOOST_PROTO_GET_POINTER(class_type, BOOST_PROTO_DEFAULT_EVAL(~, 1, expr)) ->*
+ BOOST_PROTO_DEFAULT_EVAL(~, 0, expr)
+ )(BOOST_PP_ENUM(BOOST_PP_SUB(N, 2), M0, expr));
+
                 #undef M0
             }
         };

Modified: branches/release/boost/proto/deep_copy.hpp
==============================================================================
--- branches/release/boost/proto/deep_copy.hpp (original)
+++ branches/release/boost/proto/deep_copy.hpp 2010-05-22 02:17:55 EDT (Sat, 22 May 2010)
@@ -204,7 +204,7 @@
                 template<typename Expr2, typename S, typename D>
                 result_type operator()(Expr2 const &e, S const &, D const &) const
                 {
- expr_type that = {
+ expr_type const that = {
                         BOOST_PP_ENUM(N, BOOST_PROTO_DEFINE_DEEP_COPY_FUN, ~)
                     };
 

Modified: branches/release/boost/proto/domain.hpp
==============================================================================
--- branches/release/boost/proto/domain.hpp (original)
+++ branches/release/boost/proto/domain.hpp 2010-05-22 02:17:55 EDT (Sat, 22 May 2010)
@@ -1,174 +1,305 @@
-///////////////////////////////////////////////////////////////////////////////
-/// \file domain.hpp
-/// Contains definition of domain\<\> class template and helpers for
-/// defining domains with a generator and a grammar for controlling
-/// operator overloading.
-//
-// 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_DOMAIN_HPP_EAN_02_13_2007
-#define BOOST_PROTO_DOMAIN_HPP_EAN_02_13_2007
-
-#include <boost/ref.hpp>
-#include <boost/mpl/bool.hpp>
-#include <boost/proto/proto_fwd.hpp>
-#include <boost/proto/generate.hpp>
+#ifndef BOOST_PP_IS_ITERATING
+ ///////////////////////////////////////////////////////////////////////////////
+ /// \file domain.hpp
+ /// Contains definition of domain\<\> class template and helpers for
+ /// defining domains with a generator and a grammar for controlling
+ /// operator overloading.
+ //
+ // 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_DOMAIN_HPP_EAN_02_13_2007
+ #define BOOST_PROTO_DOMAIN_HPP_EAN_02_13_2007
+
+ #include <boost/ref.hpp>
+ #include <boost/mpl/bool.hpp>
+ #include <boost/mpl/assert.hpp>
+ #include <boost/preprocessor/cat.hpp>
+ #include <boost/preprocessor/facilities/intercept.hpp>
+ #include <boost/preprocessor/iteration/iterate.hpp>
+ #include <boost/preprocessor/repetition/repeat.hpp>
+ #include <boost/preprocessor/repetition/enum_trailing_params.hpp>
+ #include <boost/preprocessor/repetition/enum_trailing_binary_params.hpp>
+ #include <boost/preprocessor/repetition/enum_params.hpp>
+ #include <boost/preprocessor/arithmetic/inc.hpp>
+ #include <boost/preprocessor/arithmetic/dec.hpp>
+ #include <boost/preprocessor/arithmetic/add.hpp>
+ #include <boost/preprocessor/control/expr_if.hpp>
+ #include <boost/proto/proto_fwd.hpp>
+ #include <boost/proto/generate.hpp>
+
+ #ifdef _MSC_VER
+ #define BOOST_PROTO_DISABLE_MSVC_C4584 __pragma(warning(disable: 4584))
+ #else
+ #define BOOST_PROTO_DISABLE_MSVC_C4584
+ #endif
 
-namespace boost { namespace proto
-{
-
- namespace detail
+ namespace boost { namespace proto
     {
- struct not_a_generator
- {};
-
- struct not_a_grammar
- {};
- }
 
- namespace domainns_
- {
- /// \brief For use in defining domain tags to be used
- /// with \c proto::extends\<\>. A \e Domain associates
- /// an expression type with a \e Generator, and optionally
- /// a \e Grammar.
- ///
- /// The Generator determines how new expressions in the
- /// domain are constructed. Typically, a generator wraps
- /// all new expressions in a wrapper that imparts
- /// domain-specific behaviors to expressions within its
- /// domain. (See \c proto::extends\<\>.)
- ///
- /// The Grammar determines whether a given expression is
- /// valid within the domain, and automatically disables
- /// any operator overloads which would cause an invalid
- /// expression to be created. By default, the Grammar
- /// parameter defaults to the wildcard, \c proto::_, which
- /// makes all expressions valid within the domain.
- ///
- /// Example:
- /// \code
- /// template<typename Expr>
- /// struct MyExpr;
- ///
- /// struct MyGrammar
- /// : or_< terminal<_>, plus<MyGrammar, MyGrammar> >
- /// {};
- ///
- /// // Define MyDomain, in which all expressions are
- /// // wrapped in MyExpr<> and only expressions that
- /// // conform to MyGrammar are allowed.
- /// struct MyDomain
- /// : domain<generator<MyExpr>, MyGrammar>
- /// {};
- ///
- /// // Use MyDomain to define MyExpr
- /// template<typename Expr>
- /// struct MyExpr
- /// : extends<Expr, MyExpr<Expr>, MyDomain>
- /// {
- /// // ...
- /// };
- /// \endcode
- ///
- template<
- typename Generator // = default_generator
- , typename Grammar // = proto::_
- >
- struct domain
- : Generator
+ namespace detail
         {
- typedef Generator proto_generator;
- typedef Grammar proto_grammar;
+ struct not_a_generator
+ {};
 
- /// INTERNAL ONLY
- typedef void proto_is_domain_;
- };
+ struct not_a_grammar
+ {};
 
- /// \brief The domain expressions have by default, if
- /// \c proto::extends\<\> has not been used to associate
- /// a domain with an expression.
- ///
- struct default_domain
- : domain<>
- {};
-
- /// \brief A pseudo-domain for use in functions and
- /// metafunctions that require a domain parameter. It
- /// indicates that the domain of the parent node should
- /// be inferred from the domains of the child nodes.
- ///
- /// \attention \c deduce_domain is not itself a valid domain.
- ///
- struct deduce_domain
- : domain<detail::not_a_generator, detail::not_a_grammar>
- {};
- }
+ struct not_a_domain
+ {};
 
- namespace result_of
- {
- /// A metafunction that returns \c mpl::true_
- /// if the type \c T is the type of a Proto domain;
- /// \c mpl::false_ otherwise. If \c T inherits from
- /// \c proto::domain\<\>, \c is_domain\<T\> is
- /// \c mpl::true_.
- template<typename T, typename Void /* = void*/>
- struct is_domain
- : mpl::false_
- {};
-
- /// INTERNAL ONLY
- ///
- template<typename T>
- struct is_domain<T, typename T::proto_is_domain_>
- : mpl::true_
- {};
-
- /// A metafunction that returns the domain of
- /// a given type. If \c T is a Proto expression
- /// type, it returns that expression's associated
- /// domain. If not, it returns
- /// \c proto::default_domain.
- template<typename T, typename Void /* = void*/>
- struct domain_of
- {
- typedef default_domain type;
- };
+ template<typename Super>
+ struct super_domain : super_domain<typename Super::super>
+ {
+ typedef Super super;
+ using super_domain<typename Super::super>::test;
+ super_domain test(super_domain);
+ super_domain test(super_domain<default_domain> const &);
+ super *& get_super();
+ };
+
+ template<>
+ struct super_domain<not_a_domain>
+ {
+ typedef not_a_domain super;
+ super_domain test(...);
+ super *& get_super();
+ };
+
+ template<>
+ struct super_domain<default_domain>
+ {
+ typedef default_domain super;
+ template<typename T> T test(T);
+ super *& get_super();
+ };
+
+ template<typename T, int N> char (&select_domain(T*&))[N];
+ template<typename T, int N> char (&select_domain(...))[1];
+
+ template<
+ int Index
+ BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(
+ BOOST_PROTO_MAX_ARITY
+ , typename D
+ , = void BOOST_PP_INTERCEPT
+ )
+ >
+ struct select_nth
+ {
+ BOOST_MPL_ASSERT_MSG((false), PROTO_DOMAIN_MISMATCH, (select_nth));
+ typedef not_a_domain type;
+ };
+
+ template<typename Void = void>
+ struct deduce_domain0
+ {
+ typedef default_domain type;
+ };
+
+ #define BOOST_PP_ITERATION_PARAMS_1 (3, (1, BOOST_PROTO_MAX_ARITY, <boost/proto/domain.hpp>))
+ #include BOOST_PP_ITERATE()
+ }
 
- /// INTERNAL ONLY
- ///
- template<typename T>
- struct domain_of<T, typename T::proto_is_expr_>
+ namespace domainns_
         {
- typedef typename T::proto_domain type;
- };
+ /// \brief For use in defining domain tags to be used
+ /// with \c proto::extends\<\>. A \e Domain associates
+ /// an expression type with a \e Generator, and optionally
+ /// a \e Grammar.
+ ///
+ /// The Generator determines how new expressions in the
+ /// domain are constructed. Typically, a generator wraps
+ /// all new expressions in a wrapper that imparts
+ /// domain-specific behaviors to expressions within its
+ /// domain. (See \c proto::extends\<\>.)
+ ///
+ /// The Grammar determines whether a given expression is
+ /// valid within the domain, and automatically disables
+ /// any operator overloads which would cause an invalid
+ /// expression to be created. By default, the Grammar
+ /// parameter defaults to the wildcard, \c proto::_, which
+ /// makes all expressions valid within the domain.
+ ///
+ /// Example:
+ /// \code
+ /// template<typename Expr>
+ /// struct MyExpr;
+ ///
+ /// struct MyGrammar
+ /// : or_< terminal<_>, plus<MyGrammar, MyGrammar> >
+ /// {};
+ ///
+ /// // Define MyDomain, in which all expressions are
+ /// // wrapped in MyExpr<> and only expressions that
+ /// // conform to MyGrammar are allowed.
+ /// struct MyDomain
+ /// : domain<generator<MyExpr>, MyGrammar>
+ /// {};
+ ///
+ /// // Use MyDomain to define MyExpr
+ /// template<typename Expr>
+ /// struct MyExpr
+ /// : extends<Expr, MyExpr<Expr>, MyDomain>
+ /// {
+ /// // ...
+ /// };
+ /// \endcode
+ ///
+ BOOST_PROTO_DISABLE_MSVC_C4584
+ template<
+ typename Generator // = default_generator
+ , typename Grammar // = proto::_
+ , typename Super // = detail::not_a_domain
+ >
+ struct domain
+ : detail::super_domain<Super>
+ , Generator
+ {
+ typedef Generator proto_generator;
+ typedef Grammar proto_grammar;
+
+ /// INTERNAL ONLY
+ typedef void proto_is_domain_;
+ };
+
+ /// \brief The domain expressions have by default, if
+ /// \c proto::extends\<\> has not been used to associate
+ /// a domain with an expression.
+ ///
+ struct default_domain
+ : domain<>
+ {};
+
+ /// \brief A pseudo-domain for use in functions and
+ /// metafunctions that require a domain parameter. It
+ /// indicates that the domain of the parent node should
+ /// be inferred from the domains of the child nodes.
+ ///
+ /// \attention \c deduce_domain is not itself a valid domain.
+ ///
+ struct deduce_domain
+ : domain<detail::not_a_generator, detail::not_a_grammar, detail::not_a_domain>
+ {};
+ }
 
- /// INTERNAL ONLY
- ///
- template<typename T>
- struct domain_of<T &, void>
+ namespace result_of
         {
- typedef typename domain_of<T>::type type;
- };
+ /// A metafunction that returns \c mpl::true_
+ /// if the type \c T is the type of a Proto domain;
+ /// \c mpl::false_ otherwise. If \c T inherits from
+ /// \c proto::domain\<\>, \c is_domain\<T\> is
+ /// \c mpl::true_.
+ template<typename T, typename Void /* = void*/>
+ struct is_domain
+ : mpl::false_
+ {};
 
- /// INTERNAL ONLY
- ///
- template<typename T>
- struct domain_of<boost::reference_wrapper<T>, void>
- {
- typedef typename domain_of<T>::type type;
- };
+ /// INTERNAL ONLY
+ ///
+ template<typename T>
+ struct is_domain<T, typename T::proto_is_domain_>
+ : mpl::true_
+ {};
+
+ /// A metafunction that returns the domain of
+ /// a given type. If \c T is a Proto expression
+ /// type, it returns that expression's associated
+ /// domain. If not, it returns
+ /// \c proto::default_domain.
+ template<typename T, typename Void /* = void*/>
+ struct domain_of
+ {
+ typedef default_domain type;
+ };
 
- /// INTERNAL ONLY
- ///
- template<typename T>
- struct domain_of<boost::reference_wrapper<T> const, void>
- {
- typedef typename domain_of<T>::type type;
- };
- }
-}}
+ /// INTERNAL ONLY
+ ///
+ template<typename T>
+ struct domain_of<T, typename T::proto_is_expr_>
+ {
+ typedef typename T::proto_domain type;
+ };
+
+ /// INTERNAL ONLY
+ ///
+ template<typename T>
+ struct domain_of<T &, void>
+ {
+ typedef typename domain_of<T>::type type;
+ };
+
+ /// INTERNAL ONLY
+ ///
+ template<typename T>
+ struct domain_of<boost::reference_wrapper<T>, void>
+ {
+ typedef typename domain_of<T>::type type;
+ };
+
+ /// INTERNAL ONLY
+ ///
+ template<typename T>
+ struct domain_of<boost::reference_wrapper<T> const, void>
+ {
+ typedef typename domain_of<T>::type type;
+ };
+ }
+ }}
+
+ #endif
+
+#else
+
+ #define N BOOST_PP_ITERATION()
+
+ template<BOOST_PP_ENUM_PARAMS(BOOST_PROTO_MAX_ARITY, typename T)>
+ struct select_nth<BOOST_PP_DEC(N), BOOST_PP_ENUM_PARAMS(BOOST_PROTO_MAX_ARITY, T)>
+ {
+ typedef BOOST_PP_CAT(T, BOOST_PP_DEC(N)) type;
+ };
+
+ template<BOOST_PP_ENUM_PARAMS(N, typename D)>
+ struct BOOST_PP_CAT(common_domain, N)
+ {
+ #define M0(Z, M, DATA) \
+ static detail::super_domain<BOOST_PP_CAT(D, M)> & BOOST_PP_CAT(d, M); \
+ /**/
+ BOOST_PP_REPEAT(N, M0, ~)
+ #undef M0
+
+ enum e
+ {
+ value0 = 0
+ #define M0(Z, M, DATA) \
+ BOOST_PP_EXPR_IF(M, .test)(BOOST_PP_CAT(d, M)) \
+ /**/
+ #define M1(Z, M, DATA) \
+ , BOOST_PP_CAT(value, BOOST_PP_INC(M)) = \
+ BOOST_PP_CAT(value, M) ? \
+ BOOST_PP_CAT(value, M) : \
+ sizeof(detail::select_domain<BOOST_PP_CAT(D, M), BOOST_PP_ADD(M, 2)>( \
+ BOOST_PP_REPEAT_ ## Z(N, M0, ~).get_super() \
+ )) - 1 \
+ /**/
+ BOOST_PP_REPEAT(N, M1, ~)
+ #undef M1
+ #undef M0
+ , value = BOOST_PP_CAT(value, N) - 1
+ };
+
+ typedef typename select_nth<value BOOST_PP_ENUM_TRAILING_PARAMS(N, D)>::type type;
+ //typedef BOOST_TYPEOF_TPL(d0.test(d1).test(d2).base()) type;
+ };
+
+ template<BOOST_PP_ENUM_PARAMS(N, typename E)>
+ struct BOOST_PP_CAT(deduce_domain, N)
+ : BOOST_PP_CAT(common_domain, N)<
+ BOOST_PP_ENUM_BINARY_PARAMS(N, typename domain_of<E, >::type BOOST_PP_INTERCEPT)
+ >
+ {};
+
+ #undef N
 
 #endif

Modified: branches/release/boost/proto/extends.hpp
==============================================================================
--- branches/release/boost/proto/extends.hpp (original)
+++ branches/release/boost/proto/extends.hpp 2010-05-22 02:17:55 EDT (Sat, 22 May 2010)
@@ -222,7 +222,7 @@
> \
               , 2 \
> that_type; \
- that_type that = { \
+ that_type const that = { \
                 *this \
               , a \
             }; \
@@ -245,62 +245,32 @@
 
         /// INTERNAL ONLY
         ///
- #define BOOST_PROTO_EXTENDS_ASSIGN_IMPL_(Const) \
+ #define BOOST_PROTO_EXTENDS_ASSIGN_IMPL_(ThisConst, ThatConst) \
         template<typename A> \
         typename boost::result_of< \
             proto_domain( \
                 boost::proto::expr< \
                     boost::proto::tag::assign \
                   , boost::proto::list2< \
- proto_derived_expr Const() & \
- , typename boost::proto::result_of::as_child<A, proto_domain>::type \
+ proto_derived_expr ThisConst() & \
+ , typename boost::proto::result_of::as_child<A ThatConst(), proto_domain>::type \
> \
                   , 2 \
> \
             ) \
>::type const \
- operator =(A &a) Const() \
+ operator =(A ThatConst() &a) ThisConst() \
         { \
             typedef boost::proto::expr< \
                 boost::proto::tag::assign \
               , boost::proto::list2< \
- proto_derived_expr Const() & \
- , typename boost::proto::result_of::as_child<A, proto_domain>::type \
+ proto_derived_expr ThisConst() & \
+ , typename boost::proto::result_of::as_child<A ThatConst(), proto_domain>::type \
> \
               , 2 \
> that_type; \
- that_type that = { \
- *static_cast<proto_derived_expr Const() *>(this) \
- , boost::proto::as_child<proto_domain>(a) \
- }; \
- return proto_domain()(that); \
- } \
- \
- template<typename A> \
- typename boost::result_of< \
- proto_domain( \
- boost::proto::expr< \
- boost::proto::tag::assign \
- , boost::proto::list2< \
- proto_derived_expr Const() & \
- , typename boost::proto::result_of::as_child<A const, proto_domain>::type \
- > \
- , 2 \
- > \
- ) \
- >::type const \
- operator =(A const &a) Const() \
- { \
- typedef boost::proto::expr< \
- boost::proto::tag::assign \
- , boost::proto::list2< \
- proto_derived_expr Const() & \
- , typename boost::proto::result_of::as_child<A const, proto_domain>::type \
- > \
- , 2 \
- > that_type; \
- that_type that = { \
- *static_cast<proto_derived_expr Const() *>(this) \
+ that_type const that = { \
+ *static_cast<proto_derived_expr ThisConst() *>(this) \
               , boost::proto::as_child<proto_domain>(a) \
             }; \
             return proto_domain()(that); \
@@ -308,16 +278,18 @@
         /**/
 
     #define BOOST_PROTO_EXTENDS_ASSIGN_CONST_() \
- BOOST_PROTO_EXTENDS_ASSIGN_IMPL_(BOOST_PROTO_CONST) \
+ BOOST_PROTO_EXTENDS_ASSIGN_IMPL_(BOOST_PROTO_CONST, BOOST_PP_EMPTY) \
+ BOOST_PROTO_EXTENDS_ASSIGN_IMPL_(BOOST_PROTO_CONST, BOOST_PROTO_CONST) \
         /**/
 
     #define BOOST_PROTO_EXTENDS_ASSIGN_NON_CONST_() \
- BOOST_PROTO_EXTENDS_ASSIGN_IMPL_(BOOST_PP_EMPTY) \
+ BOOST_PROTO_EXTENDS_ASSIGN_IMPL_(BOOST_PP_EMPTY, BOOST_PP_EMPTY) \
+ BOOST_PROTO_EXTENDS_ASSIGN_IMPL_(BOOST_PP_EMPTY, BOOST_PROTO_CONST) \
         /**/
 
     #define BOOST_PROTO_EXTENDS_ASSIGN_() \
- BOOST_PROTO_EXTENDS_ASSIGN_IMPL_(BOOST_PP_EMPTY) \
- BOOST_PROTO_EXTENDS_ASSIGN_IMPL_(BOOST_PROTO_CONST) \
+ BOOST_PROTO_EXTENDS_ASSIGN_CONST_() \
+ BOOST_PROTO_EXTENDS_ASSIGN_NON_CONST_() \
         /**/
 
     #define BOOST_PROTO_EXTENDS_ASSIGN_CONST() \
@@ -337,62 +309,32 @@
 
         /// INTERNAL ONLY
         ///
- #define BOOST_PROTO_EXTENDS_SUBSCRIPT_IMPL_(Const) \
- template<typename A> \
- typename boost::result_of< \
- proto_domain( \
- boost::proto::expr< \
- boost::proto::tag::subscript \
- , boost::proto::list2< \
- proto_derived_expr Const() & \
- , typename boost::proto::result_of::as_child<A, proto_domain>::type \
- > \
- , 2 \
- > \
- ) \
- >::type const \
- operator [](A &a) Const() \
- { \
- typedef boost::proto::expr< \
- boost::proto::tag::subscript \
- , boost::proto::list2< \
- proto_derived_expr Const() & \
- , typename boost::proto::result_of::as_child<A, proto_domain>::type \
- > \
- , 2 \
- > that_type; \
- that_type that = { \
- *static_cast<proto_derived_expr Const() *>(this) \
- , boost::proto::as_child<proto_domain>(a) \
- }; \
- return proto_domain()(that); \
- } \
- \
+ #define BOOST_PROTO_EXTENDS_SUBSCRIPT_IMPL_(ThisConst, ThatConst) \
         template<typename A> \
         typename boost::result_of< \
             proto_domain( \
                 boost::proto::expr< \
                     boost::proto::tag::subscript \
                   , boost::proto::list2< \
- proto_derived_expr Const() & \
- , typename boost::proto::result_of::as_child<A const, proto_domain>::type \
+ proto_derived_expr ThisConst() & \
+ , typename boost::proto::result_of::as_child<A ThatConst(), proto_domain>::type \
> \
                   , 2 \
> \
             ) \
>::type const \
- operator [](A const &a) Const() \
+ operator [](A ThatConst() &a) ThisConst() \
         { \
             typedef boost::proto::expr< \
                 boost::proto::tag::subscript \
               , boost::proto::list2< \
- proto_derived_expr Const() & \
- , typename boost::proto::result_of::as_child<A const, proto_domain>::type \
+ proto_derived_expr ThisConst() & \
+ , typename boost::proto::result_of::as_child<A ThatConst(), proto_domain>::type \
> \
               , 2 \
> that_type; \
- that_type that = { \
- *static_cast<proto_derived_expr Const() *>(this) \
+ that_type const that = { \
+ *static_cast<proto_derived_expr ThisConst() *>(this) \
               , boost::proto::as_child<proto_domain>(a) \
             }; \
             return proto_domain()(that); \
@@ -400,11 +342,13 @@
         /**/
 
     #define BOOST_PROTO_EXTENDS_SUBSCRIPT_CONST() \
- BOOST_PROTO_EXTENDS_SUBSCRIPT_IMPL_(BOOST_PROTO_CONST) \
+ BOOST_PROTO_EXTENDS_SUBSCRIPT_IMPL_(BOOST_PROTO_CONST, BOOST_PP_EMPTY) \
+ BOOST_PROTO_EXTENDS_SUBSCRIPT_IMPL_(BOOST_PROTO_CONST, BOOST_PROTO_CONST) \
         /**/
 
     #define BOOST_PROTO_EXTENDS_SUBSCRIPT_NON_CONST() \
- BOOST_PROTO_EXTENDS_SUBSCRIPT_IMPL_(BOOST_PP_EMPTY) \
+ BOOST_PROTO_EXTENDS_SUBSCRIPT_IMPL_(BOOST_PP_EMPTY, BOOST_PP_EMPTY) \
+ BOOST_PROTO_EXTENDS_SUBSCRIPT_IMPL_(BOOST_PP_EMPTY, BOOST_PROTO_CONST) \
         /**/
 
     #define BOOST_PROTO_EXTENDS_SUBSCRIPT() \
@@ -668,24 +612,30 @@
 
         /// INTERNAL ONLY
         ///
- #define BOOST_PROTO_EXTENDS_MEMBER_(R, DATA, ELEM) \
+ #define BOOST_PROTO_EXTENDS_MEMBER_(R, DOMAIN, ELEM) \
             boost::proto::exprns_::virtual_member< \
                 proto_derived_expr \
               , BOOST_PP_TUPLE_ELEM(2, 0, ELEM) \
- , proto_domain \
+ , DOMAIN \
> BOOST_PP_TUPLE_ELEM(2, 1, ELEM); \
             /**/
 
         /// \brief For declaring virtual data members in an extension class.
         ///
- #define BOOST_PROTO_EXTENDS_MEMBERS(SEQ) \
+ #define BOOST_PROTO_EXTENDS_MEMBERS_WITH_DOMAIN(SEQ, DOMAIN) \
             union \
             { \
                 char proto_member_union_start_; \
- BOOST_PP_SEQ_FOR_EACH(BOOST_PROTO_EXTENDS_MEMBER_, ~, SEQ) \
+ BOOST_PP_SEQ_FOR_EACH(BOOST_PROTO_EXTENDS_MEMBER_, DOMAIN, SEQ) \
             }; \
             /**/
 
+ /// \brief For declaring virtual data members in an extension class.
+ ///
+ #define BOOST_PROTO_EXTENDS_MEMBERS(SEQ) \
+ BOOST_PROTO_EXTENDS_MEMBERS_WITH_DOMAIN(SEQ, proto_domain) \
+ /**/
+
     }
 
 }}

Modified: branches/release/boost/proto/make_expr.hpp
==============================================================================
--- branches/release/boost/proto/make_expr.hpp (original)
+++ branches/release/boost/proto/make_expr.hpp 2010-05-22 02:17:55 EDT (Sat, 22 May 2010)
@@ -91,7 +91,7 @@
     /// INTERNAL ONLY
     ///
     #define BOOST_PROTO_FUSION_NEXT_ITERATOR_TYPE(Z, N, DATA) \
- typedef typename fusion::result_of::next< \
+ typedef typename fusion::result_of::next< \
             BOOST_PP_CAT(fusion_iterator, N)>::type \
                 BOOST_PP_CAT(fusion_iterator, BOOST_PP_INC(N)); \
         /**/
@@ -100,7 +100,7 @@
     ///
     #define BOOST_PROTO_FUSION_ITERATORS_TYPE(N) \
         typedef \
- typename fusion::result_of::begin<Sequence const>::type \
+ typename fusion::result_of::begin<Sequence const>::type \
         fusion_iterator0; \
         BOOST_PP_REPEAT(BOOST_PP_DEC(N), BOOST_PROTO_FUSION_NEXT_ITERATOR_TYPE, fusion_iterator) \
         /**/
@@ -109,7 +109,7 @@
     ///
     #define BOOST_PROTO_FUSION_AT_TYPE(Z, N, DATA) \
         typename add_const< \
- typename fusion::result_of::value_of< \
+ typename fusion::result_of::value_of< \
                 BOOST_PP_CAT(fusion_iterator, N) \
>::type \
>::type \
@@ -193,47 +193,6 @@
                 }
             };
 
- template<
- int Index
- BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(
- BOOST_PROTO_MAX_ARITY
- , typename D
- , = void BOOST_PP_INTERCEPT
- )
- >
- struct select_nth
- {
- BOOST_MPL_ASSERT_MSG((false), PROTO_DOMAIN_MISMATCH, (select_nth));
- typedef default_domain type;
- };
-
- template<typename Void = void>
- struct deduce_domain0
- {
- typedef default_domain type;
- };
-
- template<int I>
- struct sized
- {
- char buffer[I];
- };
-
- template<typename T>
- struct nondeduced_domain
- {
- typedef nondeduced_domain type;
- nondeduced_domain(T);
- nondeduced_domain(default_domain);
- };
-
- template<>
- struct nondeduced_domain<default_domain>
- {
- typedef nondeduced_domain type;
- nondeduced_domain(default_domain);
- };
-
             template<typename Tag, typename Domain, typename Sequence, std::size_t Size>
             struct unpack_expr_
             {};
@@ -899,59 +858,6 @@
         };
     #endif
 
- template<BOOST_PP_ENUM_PARAMS(BOOST_PROTO_MAX_ARITY, typename T)>
- struct select_nth<BOOST_PP_DEC(N), BOOST_PP_ENUM_PARAMS(BOOST_PROTO_MAX_ARITY, T)>
- {
- typedef BOOST_PP_CAT(T, BOOST_PP_DEC(N)) type;
- };
-
- // Use function overloading as an efficient mechanism for
- // calculating the domain shared by a bunch of proto expressions
- // (or non-expressions, assumed to be in the default_domain).
- // The domain of a set of domains S is deduced as follows:
- // - If S contains only default_domain, the deduced domain is
- // default_domain.
- // - If S contains only X and default_domain, the deduced domain
- // is X.
- // - If S contains different domains X and Y, neither of which is
- // default_domain, it is an error.
- template<BOOST_PP_ENUM_PARAMS(N, typename A)>
- struct BOOST_PP_CAT(deduce_domain, N)
- {
- #if BOOST_WORKAROUND(BOOST_MSVC, == 1310)
- // The function overloading trick doesn't work on MSVC-7.1, so
- // do it the hard (expensive) way.
- typedef
- typename mpl::eval_if_c<
- is_same<typename domain_of<A0>::type, default_domain>::value
- , BOOST_PP_CAT(deduce_domain, BOOST_PP_DEC(N))<BOOST_PP_ENUM_SHIFTED_PARAMS(N, A)>
- , domain_of<A0>
- >::type
- type;
- #else
- #define M0(N, F) char (&F)[BOOST_PP_INC(N)]
- static M0(BOOST_PROTO_MAX_ARITY, deducer(...));
- #define M1(Z, X, DATA) \
- typedef typename domain_of<BOOST_PP_CAT(A, X)>::type BOOST_PP_CAT(D, X); \
- static BOOST_PP_CAT(D, X) &BOOST_PP_CAT(d, X); \
- template<typename T> \
- static M0(X, deducer( \
- BOOST_PP_ENUM_PARAMS_Z(Z, X, default_domain BOOST_PP_INTERCEPT) \
- BOOST_PP_COMMA_IF(X) T \
- BOOST_PP_ENUM_TRAILING_PARAMS_Z( \
- Z \
- , BOOST_PP_DEC(BOOST_PP_SUB(N, X)) \
- , typename nondeduced_domain<T>::type BOOST_PP_INTERCEPT \
- ) \
- ));
- BOOST_PP_REPEAT(N, M1, ~)
- #undef M0
- #undef M1
- BOOST_STATIC_CONSTANT(int, value = sizeof(deducer(BOOST_PP_ENUM_PARAMS(N, d))) - 1);
- typedef typename select_nth<value, BOOST_PP_ENUM_PARAMS(N, D)>::type type;
- #endif
- };
-
         template<typename Tag, typename Domain BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
         struct make_expr_<Tag, Domain BOOST_PP_ENUM_TRAILING_PARAMS(N, A)
             BOOST_PP_ENUM_TRAILING_PARAMS(M, void BOOST_PP_INTERCEPT), void>
@@ -966,7 +872,7 @@
 
             result_type operator()(BOOST_PP_ENUM_BINARY_PARAMS(N, typename add_reference<A, >::type a)) const
             {
- expr_type that = {
+ expr_type const that = {
                     BOOST_PP_ENUM(N, BOOST_PROTO_AS_CHILD, (A, a, Domain))
                 };
                 return Domain()(that);
@@ -1001,7 +907,7 @@
             static type const call(Sequence const &sequence)
             {
                 BOOST_PROTO_FUSION_ITERATORS(N)
- expr_type that = {
+ expr_type const that = {
                     BOOST_PP_ENUM(N, BOOST_PROTO_FUSION_AS_CHILD_AT, ~)
                 };
                 return Domain()(that);

Modified: branches/release/boost/proto/matches.hpp
==============================================================================
--- branches/release/boost/proto/matches.hpp (original)
+++ branches/release/boost/proto/matches.hpp 2010-05-22 02:17:55 EDT (Sat, 22 May 2010)
@@ -16,15 +16,17 @@
     #include <boost/preprocessor/cat.hpp>
     #include <boost/preprocessor/arithmetic/dec.hpp>
     #include <boost/preprocessor/arithmetic/sub.hpp>
- #include <boost/preprocessor/repetition/enum.hpp>
     #include <boost/preprocessor/iteration/iterate.hpp>
     #include <boost/preprocessor/facilities/intercept.hpp>
     #include <boost/preprocessor/punctuation/comma_if.hpp>
+ #include <boost/preprocessor/repetition/enum.hpp>
     #include <boost/preprocessor/repetition/enum_params.hpp>
     #include <boost/preprocessor/repetition/enum_shifted.hpp>
+ #include <boost/preprocessor/repetition/enum_binary_params.hpp>
     #include <boost/preprocessor/repetition/enum_shifted_params.hpp>
     #include <boost/preprocessor/repetition/enum_trailing_params.hpp>
     #include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
+ #include <boost/preprocessor/repetition/repeat.hpp>
     #include <boost/config.hpp>
     #include <boost/mpl/logical.hpp>
     #include <boost/mpl/eval_if.hpp>
@@ -71,20 +73,8 @@
             template<bool B, typename Pred>
             struct and_2;
 
- template<typename And>
- struct last;
-
- template<>
- struct last<proto::and_<> >
- {
- typedef proto::_ type;
- };
-
- template<typename G0>
- struct last<proto::and_<G0> >
- {
- typedef G0 type;
- };
+ template<typename And, typename Expr, typename State, typename Data>
+ struct _and_impl;
 
             template<typename T, typename U>
             struct array_matches
@@ -587,6 +577,19 @@
             };
         }
 
+ namespace detail
+ {
+ template<typename Expr, typename State, typename Data>
+ struct _and_impl<proto::and_<>, Expr, State, Data>
+ : proto::_::impl<Expr, State, Data>
+ {};
+
+ template<typename G0, typename Expr, typename State, typename Data>
+ struct _and_impl<proto::and_<G0>, Expr, State, Data>
+ : proto::when<proto::_, G0>::template impl<Expr, State, Data>
+ {};
+ }
+
         namespace control
         {
             /// \brief Inverts the set of expressions matched by a grammar. When
@@ -754,15 +757,15 @@
             };
 
             /// \brief For matching all of a set of grammars. When used as a
- /// transform, \c and_\<\> applies the transform associated with
- /// the last grammar in the set.
+ /// transform, \c and_\<\> applies the transforms associated with
+ /// the each grammar in the set, and returns the result of the last.
             ///
             /// An expression type \c E matches <tt>and_\<B0,B1,...Bn\></tt> if \c E
             /// matches all \c Bx for \c x in <tt>[0,n)</tt>.
             ///
             /// When applying <tt>and_\<B0,B1,...Bn\></tt> as a transform with an
             /// expression \c e, state \c s and data \c d, it is
- /// equivalent to <tt>Bn()(e, s, d)</tt>.
+ /// equivalent to <tt>(B0()(e, s, d),B1()(e, s, d),...Bn()(e, s, d))</tt>.
             template<BOOST_PP_ENUM_PARAMS(BOOST_PROTO_MAX_LOGICAL_ARITY, typename G)>
             struct and_ : transform<and_<BOOST_PP_ENUM_PARAMS(BOOST_PROTO_MAX_LOGICAL_ARITY, G)> >
             {
@@ -770,15 +773,8 @@
 
                 template<typename Expr, typename State, typename Data>
                 struct impl
- : detail::last<and_>::type::template impl<Expr, State, Data>
- {
- /// \param e An expression
- /// \param s The current state
- /// \param d A data of arbitrary type
- /// \pre <tt>matches\<Expr,and_\>::::value</tt> is \c true.
- /// \return <tt>which()(e, s, d)</tt>, where <tt>which</tt> is
- /// the last non-void sub-grammar in the <tt>and_\<\></tt>.
- };
+ : detail::_and_impl<and_, Expr, State, Data>
+ {};
             };
 
             /// \brief For matching one of a set of alternate grammars, which
@@ -947,10 +943,31 @@
             {};
 
         #if N <= BOOST_PROTO_MAX_LOGICAL_ARITY
- template<BOOST_PP_ENUM_PARAMS(N, typename G)>
- struct last<proto::and_<BOOST_PP_ENUM_PARAMS(N, G)> >
+ template<BOOST_PP_ENUM_PARAMS(N, typename G), typename Expr, typename State, typename Data>
+ struct _and_impl<proto::and_<BOOST_PP_ENUM_PARAMS(N, G)>, Expr, State, Data>
+ : proto::transform_impl<Expr, State, Data>
             {
- typedef BOOST_PP_CAT(G, BOOST_PP_DEC(N)) type;
+ #define M0(Z, N, DATA) \
+ typedef \
+ typename proto::when<proto::_, BOOST_PP_CAT(G, N)> \
+ ::template impl<Expr, State, Data> \
+ BOOST_PP_CAT(Gimpl, N); \
+ /**/
+ BOOST_PP_REPEAT(N, M0, ~)
+
+ typedef typename BOOST_PP_CAT(Gimpl, BOOST_PP_DEC(N))::result_type result_type;
+
+ result_type operator()(
+ typename _and_impl::expr_param e
+ , typename _and_impl::state_param s
+ , typename _and_impl::data_param d
+ ) const
+ {
+ // expands to (G0()(e,s,d),G1()(e,s,d),...);
+ return (BOOST_PP_ENUM_BINARY_PARAMS(N, Gimpl, ()(e,s,d) BOOST_PP_INTERCEPT));
+ }
+
+ #undef M0
             };
 
             template<bool B, typename Expr, BOOST_PP_ENUM_PARAMS(N, typename G)>

Modified: branches/release/boost/proto/operators.hpp
==============================================================================
--- branches/release/boost/proto/operators.hpp (original)
+++ branches/release/boost/proto/operators.hpp 2010-05-22 02:17:55 EDT (Sat, 22 May 2010)
@@ -18,6 +18,7 @@
 #include <boost/proto/proto_fwd.hpp>
 #include <boost/proto/tags.hpp>
 #include <boost/proto/expr.hpp>
+#include <boost/proto/domain.hpp>
 #include <boost/proto/matches.hpp>
 #include <boost/proto/generate.hpp>
 #include <boost/proto/make_expr.hpp>
@@ -26,31 +27,6 @@
 {
     namespace detail
     {
- template<typename Domain1, typename Domain2>
- struct choose_domain2
- {
- BOOST_MPL_ASSERT((boost::is_same<Domain1, Domain2>));
- typedef Domain1 type;
- };
-
- template<typename Domain1>
- struct choose_domain2<Domain1, proto::default_domain>
- {
- typedef Domain1 type;
- };
-
- template<typename Domain2>
- struct choose_domain2<proto::default_domain, Domain2>
- {
- typedef Domain2 type;
- };
-
- template<>
- struct choose_domain2<proto::default_domain, proto::default_domain>
- {
- typedef proto::default_domain type;
- };
-
         template<typename Domain, typename Expr, typename EnableIf = void>
         struct generate_if
           : lazy_enable_if_c<
@@ -120,8 +96,8 @@
             static typename proto_domain::template result<proto_domain(expr_type)>::type
             make(Left &left, Right &right)
             {
- term_type term = {right};
- expr_type that = {left, proto_domain()(term)};
+ term_type const term = {right};
+ expr_type const that = {left, proto_domain()(term)};
                 return proto_domain()(that);
             }
         };
@@ -142,8 +118,8 @@
             static typename proto_domain::template result<proto_domain(expr_type)>::type
             make(Left &left, Right &right)
             {
- term_type term = {left};
- expr_type that = {proto_domain()(term), right};
+ term_type const term = {left};
+ expr_type const that = {proto_domain()(term), right};
                 return proto_domain()(that);
             }
         };
@@ -156,17 +132,17 @@
         template<typename Tag, typename Left, typename Right>
         struct as_expr_if<Tag, Left, Right, typename Left::proto_is_expr_, typename Right::proto_is_expr_>
           : generate_if<
- typename choose_domain2<typename Left::proto_domain, typename Right::proto_domain>::type
+ typename common_domain2<typename Left::proto_domain, typename Right::proto_domain>::type
               , proto::expr<Tag, list2<Left &, Right &>, 2>
>
         {
             typedef proto::expr<Tag, list2<Left &, Right &>, 2> expr_type;
- typedef typename choose_domain2<typename Left::proto_domain, typename Right::proto_domain>::type proto_domain;
+ typedef typename common_domain2<typename Left::proto_domain, typename Right::proto_domain>::type proto_domain;
 
             static typename proto_domain::template result<proto_domain(expr_type)>::type
             make(Left &left, Right &right)
             {
- expr_type that = {left, right};
+ expr_type const that = {left, right};
                 return proto_domain()(that);
             }
         };
@@ -252,7 +228,7 @@
     operator OP(Arg &arg BOOST_PROTO_UNARY_OP_IS_POSTFIX_ ## POST) \
     { \
         typedef proto::expr<TAG, list1<Arg &>, 1> that_type; \
- that_type that = {arg}; \
+ that_type const that = {arg}; \
         return typename Arg::proto_domain()(that); \
     } \
     template<typename Arg> \
@@ -264,7 +240,7 @@
     operator OP(Arg const &arg BOOST_PROTO_UNARY_OP_IS_POSTFIX_ ## POST) \
     { \
         typedef proto::expr<TAG, list1<Arg const &>, 1> that_type; \
- that_type that = {arg}; \
+ that_type const that = {arg}; \
         return typename Arg::proto_domain()(that); \
     } \
     /**/

Modified: branches/release/boost/proto/proto_fwd.hpp
==============================================================================
--- branches/release/boost/proto/proto_fwd.hpp (original)
+++ branches/release/boost/proto/proto_fwd.hpp 2010-05-22 02:17:55 EDT (Sat, 22 May 2010)
@@ -138,6 +138,10 @@
             typename boost::remove_const<typename boost::remove_reference<X>::type>::type
 
         struct _default;
+
+ struct not_a_domain;
+ struct not_a_grammar;
+ struct not_a_generator;
     }
 
     typedef detail::ignore const ignore;
@@ -255,7 +259,11 @@
     ////////////////////////////////////////////////////////////////////////////////////////////////
     namespace domainns_
     {
- template<typename Generator = default_generator, typename Grammar = proto::_>
+ template<
+ typename Generator = default_generator
+ , typename Grammar = proto::_
+ , typename Super = detail::not_a_domain
+ >
         struct domain;
 
         struct default_domain;
@@ -717,6 +725,8 @@
 
     struct _value;
 
+ struct _void;
+
     template<int I>
     struct _child_c;
 

Modified: branches/release/boost/proto/proto_typeof.hpp
==============================================================================
--- branches/release/boost/proto/proto_typeof.hpp (original)
+++ branches/release/boost/proto/proto_typeof.hpp 2010-05-22 02:17:55 EDT (Sat, 22 May 2010)
@@ -67,6 +67,11 @@
 BOOST_TYPEOF_REGISTER_TEMPLATE(boost::proto::exprns_::expr, (typename)(typename)(long))
 BOOST_TYPEOF_REGISTER_TEMPLATE(boost::proto::utility::literal, (typename)(typename))
 
+BOOST_TYPEOF_REGISTER_TYPE(boost::proto::detail::not_a_generator)
+BOOST_TYPEOF_REGISTER_TYPE(boost::proto::detail::not_a_grammar)
+BOOST_TYPEOF_REGISTER_TYPE(boost::proto::detail::not_a_domain)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::proto::domainns_::domain, 3)
+
 BOOST_TYPEOF_REGISTER_TEMPLATE(boost::proto::argsns_::term, 1)
 BOOST_TYPEOF_REGISTER_TEMPLATE(boost::proto::argsns_::list1, 1)
 BOOST_TYPEOF_REGISTER_TEMPLATE(boost::proto::argsns_::list2, 2)

Modified: branches/release/boost/proto/transform/arg.hpp
==============================================================================
--- branches/release/boost/proto/transform/arg.hpp (original)
+++ branches/release/boost/proto/transform/arg.hpp 2010-05-22 02:17:55 EDT (Sat, 22 May 2010)
@@ -210,6 +210,25 @@
         };
     };
 
+ /// \brief A PrimitiveTransform that does nothing
+ /// and returns void.
+ struct _void : transform<_void>
+ {
+ template<typename Expr, typename State, typename Data>
+ struct impl : transform_impl<Expr, State, Data>
+ {
+ typedef void result_type;
+
+ /// Does nothing and returns void
+ void operator ()(
+ typename impl::expr_param
+ , typename impl::state_param
+ , typename impl::data_param
+ ) const
+ {}
+ };
+ };
+
     /// \brief A unary CallableTransform that wraps its argument
     /// in a \c boost::reference_wrapper\<\>.
     ///

Modified: branches/release/boost/proto/transform/default.hpp
==============================================================================
--- branches/release/boost/proto/transform/default.hpp (original)
+++ branches/release/boost/proto/transform/default.hpp 2010-05-22 02:17:55 EDT (Sat, 22 May 2010)
@@ -13,6 +13,9 @@
 
     #include <boost/preprocessor/iteration/iterate.hpp>
     #include <boost/preprocessor/repetition/repeat.hpp>
+ #include <boost/preprocessor/arithmetic/add.hpp>
+ #include <boost/preprocessor/arithmetic/sub.hpp>
+ #include <boost/preprocessor/repetition/enum.hpp>
     #include <boost/preprocessor/repetition/enum_shifted.hpp>
     #include <boost/preprocessor/repetition/enum_shifted_params.hpp>
     #include <boost/ref.hpp>
@@ -29,114 +32,143 @@
 
     namespace boost { namespace proto
     {
- template<typename Grammar /*= detail::_default*/>
- struct _default
- : transform<_default<Grammar> >
+ namespace detail
         {
- template<typename Expr, typename State, typename Data, typename Tag, long Arity>
- struct impl2;
+ template<typename Grammar, typename Tag>
+ struct default_case
+ : not_<_>
+ {};
 
- template<typename Expr, typename State, typename Data, typename Tag>
- struct impl2<Expr, State, Data, Tag, 0>
- : _value::impl<Expr, State, Data>
- {};
-
- #define BOOST_PROTO_UNARY_OP_RESULT(OP, TAG, MAKE) \
- template<typename Expr, typename State, typename Data> \
- struct impl2<Expr, State, Data, TAG, 1> \
- : transform_impl<Expr, State, Data> \
- { \
- private: \
- typedef typename result_of::child_c<Expr, 0>::type e0; \
- typedef typename Grammar::template impl<e0, State, Data>::result_type r0; \
- public: \
- BOOST_PROTO_DECLTYPE_(OP proto::detail::MAKE<r0>(), result_type) \
- result_type operator ()( \
- typename impl2::expr_param e \
- , typename impl2::state_param s \
- , typename impl2::data_param d \
- ) const \
- { \
- typename Grammar::template impl<e0, State, Data> t0; \
- return OP t0(proto::child_c<0>(e), s, d); \
- } \
- }; \
+ template<typename Grammar>
+ struct default_case<Grammar, tag::terminal>
+ : when<terminal<_>, _value>
+ {};
+
+ template<typename Grammar>
+ struct default_cases
+ {
+ template<typename Tag>
+ struct case_
+ : default_case<Grammar, Tag>
+ {};
+ };
+
+ #define BOOST_PROTO_UNARY_DEFAULT_EVAL(OP, TAG, MAKE) \
+ template<typename Grammar> \
+ struct BOOST_PP_CAT(default_, TAG) \
+ : transform<BOOST_PP_CAT(default_, TAG)<Grammar> > \
+ { \
+ template<typename Expr, typename State, typename Data> \
+ struct impl \
+ : transform_impl<Expr, State, Data> \
+ { \
+ private: \
+ typedef typename result_of::child_c<Expr, 0>::type e0; \
+ typedef typename Grammar::template impl<e0, State, Data>::result_type r0; \
+ public: \
+ BOOST_PROTO_DECLTYPE_(OP proto::detail::MAKE<r0>(), result_type) \
+ result_type operator ()( \
+ typename impl::expr_param e \
+ , typename impl::state_param s \
+ , typename impl::data_param d \
+ ) const \
+ { \
+ typename Grammar::template impl<e0, State, Data> t0; \
+ return OP t0(proto::child_c<0>(e), s, d); \
+ } \
+ }; \
+ }; \
+ \
+ template<typename Grammar> \
+ struct default_case<Grammar, tag::TAG> \
+ : when<unary_expr<tag::TAG, Grammar>, BOOST_PP_CAT(default_, TAG)<Grammar> > \
+ {}; \
             /**/
 
- #define BOOST_PROTO_BINARY_OP_RESULT(OP, TAG, LMAKE, RMAKE) \
- template<typename Expr, typename State, typename Data> \
- struct impl2<Expr, State, Data, TAG, 2> \
- : transform_impl<Expr, State, Data> \
- { \
- private: \
- typedef typename result_of::child_c<Expr, 0>::type e0; \
- typedef typename result_of::child_c<Expr, 1>::type e1; \
- typedef typename Grammar::template impl<e0, State, Data>::result_type r0; \
- typedef typename Grammar::template impl<e1, State, Data>::result_type r1; \
- public: \
- BOOST_PROTO_DECLTYPE_( \
- proto::detail::LMAKE<r0>() OP proto::detail::RMAKE<r1>() \
- , result_type \
- ) \
- result_type operator ()( \
- typename impl2::expr_param e \
- , typename impl2::state_param s \
- , typename impl2::data_param d \
- ) const \
- { \
- typename Grammar::template impl<e0, State, Data> t0; \
- typename Grammar::template impl<e1, State, Data> t1; \
- return t0(proto::child_c<0>(e), s, d) \
- OP t1(proto::child_c<1>(e), s, d); \
- } \
- }; \
+ #define BOOST_PROTO_BINARY_DEFAULT_EVAL(OP, TAG, LMAKE, RMAKE) \
+ template<typename Grammar> \
+ struct BOOST_PP_CAT(default_, TAG) \
+ : transform<BOOST_PP_CAT(default_, TAG)<Grammar> > \
+ { \
+ template<typename Expr, typename State, typename Data> \
+ struct impl \
+ : transform_impl<Expr, State, Data> \
+ { \
+ private: \
+ typedef typename result_of::child_c<Expr, 0>::type e0; \
+ typedef typename result_of::child_c<Expr, 1>::type e1; \
+ typedef typename Grammar::template impl<e0, State, Data>::result_type r0; \
+ typedef typename Grammar::template impl<e1, State, Data>::result_type r1; \
+ public: \
+ BOOST_PROTO_DECLTYPE_( \
+ proto::detail::LMAKE<r0>() OP proto::detail::RMAKE<r1>() \
+ , result_type \
+ ) \
+ result_type operator ()( \
+ typename impl::expr_param e \
+ , typename impl::state_param s \
+ , typename impl::data_param d \
+ ) const \
+ { \
+ typename Grammar::template impl<e0, State, Data> t0; \
+ typename Grammar::template impl<e1, State, Data> t1; \
+ return t0(proto::child_c<0>(e), s, d) \
+ OP t1(proto::child_c<1>(e), s, d); \
+ } \
+ }; \
+ }; \
+ \
+ template<typename Grammar> \
+ struct default_case<Grammar, tag::TAG> \
+ : when<binary_expr<tag::TAG, Grammar, Grammar>, BOOST_PP_CAT(default_, TAG)<Grammar> > \
+ {}; \
             /**/
 
- BOOST_PROTO_UNARY_OP_RESULT(+, tag::unary_plus, make)
- BOOST_PROTO_UNARY_OP_RESULT(-, tag::negate, make)
- BOOST_PROTO_UNARY_OP_RESULT(*, tag::dereference, make)
- BOOST_PROTO_UNARY_OP_RESULT(~, tag::complement, make)
- BOOST_PROTO_UNARY_OP_RESULT(&, tag::address_of, make)
- BOOST_PROTO_UNARY_OP_RESULT(!, tag::logical_not, make)
- BOOST_PROTO_UNARY_OP_RESULT(++, tag::pre_inc, make_mutable)
- BOOST_PROTO_UNARY_OP_RESULT(--, tag::pre_dec, make_mutable)
-
- BOOST_PROTO_BINARY_OP_RESULT(<<, tag::shift_left, make_mutable, make)
- BOOST_PROTO_BINARY_OP_RESULT(>>, tag::shift_right, make_mutable, make_mutable)
- BOOST_PROTO_BINARY_OP_RESULT(*, tag::multiplies, make, make)
- BOOST_PROTO_BINARY_OP_RESULT(/, tag::divides, make, make)
- BOOST_PROTO_BINARY_OP_RESULT(%, tag::modulus, make, make)
- BOOST_PROTO_BINARY_OP_RESULT(+, tag::plus, make, make)
- BOOST_PROTO_BINARY_OP_RESULT(-, tag::minus, make, make)
- BOOST_PROTO_BINARY_OP_RESULT(<, tag::less, make, make)
- BOOST_PROTO_BINARY_OP_RESULT(>, tag::greater, make, make)
- BOOST_PROTO_BINARY_OP_RESULT(<=, tag::less_equal, make, make)
- BOOST_PROTO_BINARY_OP_RESULT(>=, tag::greater_equal, make, make)
- BOOST_PROTO_BINARY_OP_RESULT(==, tag::equal_to, make, make)
- BOOST_PROTO_BINARY_OP_RESULT(!=, tag::not_equal_to, make, make)
- BOOST_PROTO_BINARY_OP_RESULT(||, tag::logical_or, make, make)
- BOOST_PROTO_BINARY_OP_RESULT(&&, tag::logical_and, make, make)
- BOOST_PROTO_BINARY_OP_RESULT(&, tag::bitwise_and, make, make)
- BOOST_PROTO_BINARY_OP_RESULT(|, tag::bitwise_or, make, make)
- BOOST_PROTO_BINARY_OP_RESULT(^, tag::bitwise_xor, make, make)
-
- BOOST_PROTO_BINARY_OP_RESULT(=, tag::assign, make_mutable, make)
- BOOST_PROTO_BINARY_OP_RESULT(<<=, tag::shift_left_assign, make_mutable, make)
- BOOST_PROTO_BINARY_OP_RESULT(>>=, tag::shift_right_assign, make_mutable, make)
- BOOST_PROTO_BINARY_OP_RESULT(*=, tag::multiplies_assign, make_mutable, make)
- BOOST_PROTO_BINARY_OP_RESULT(/=, tag::divides_assign, make_mutable, make)
- BOOST_PROTO_BINARY_OP_RESULT(%=, tag::modulus_assign, make_mutable, make)
- BOOST_PROTO_BINARY_OP_RESULT(+=, tag::plus_assign, make_mutable, make)
- BOOST_PROTO_BINARY_OP_RESULT(-=, tag::minus_assign, make_mutable, make)
- BOOST_PROTO_BINARY_OP_RESULT(&=, tag::bitwise_and_assign, make_mutable, make)
- BOOST_PROTO_BINARY_OP_RESULT(|=, tag::bitwise_or_assign, make_mutable, make)
- BOOST_PROTO_BINARY_OP_RESULT(^=, tag::bitwise_xor_assign, make_mutable, make)
+ BOOST_PROTO_UNARY_DEFAULT_EVAL(+, unary_plus, make)
+ BOOST_PROTO_UNARY_DEFAULT_EVAL(-, negate, make)
+ BOOST_PROTO_UNARY_DEFAULT_EVAL(*, dereference, make)
+ BOOST_PROTO_UNARY_DEFAULT_EVAL(~, complement, make)
+ BOOST_PROTO_UNARY_DEFAULT_EVAL(&, address_of, make)
+ BOOST_PROTO_UNARY_DEFAULT_EVAL(!, logical_not, make)
+ BOOST_PROTO_UNARY_DEFAULT_EVAL(++, pre_inc, make_mutable)
+ BOOST_PROTO_UNARY_DEFAULT_EVAL(--, pre_dec, make_mutable)
+
+ BOOST_PROTO_BINARY_DEFAULT_EVAL(<<, shift_left, make_mutable, make)
+ BOOST_PROTO_BINARY_DEFAULT_EVAL(>>, shift_right, make_mutable, make_mutable)
+ BOOST_PROTO_BINARY_DEFAULT_EVAL(*, multiplies, make, make)
+ BOOST_PROTO_BINARY_DEFAULT_EVAL(/, divides, make, make)
+ BOOST_PROTO_BINARY_DEFAULT_EVAL(%, modulus, make, make)
+ BOOST_PROTO_BINARY_DEFAULT_EVAL(+, plus, make, make)
+ BOOST_PROTO_BINARY_DEFAULT_EVAL(-, minus, make, make)
+ BOOST_PROTO_BINARY_DEFAULT_EVAL(<, less, make, make)
+ BOOST_PROTO_BINARY_DEFAULT_EVAL(>, greater, make, make)
+ BOOST_PROTO_BINARY_DEFAULT_EVAL(<=, less_equal, make, make)
+ BOOST_PROTO_BINARY_DEFAULT_EVAL(>=, greater_equal, make, make)
+ BOOST_PROTO_BINARY_DEFAULT_EVAL(==, equal_to, make, make)
+ BOOST_PROTO_BINARY_DEFAULT_EVAL(!=, not_equal_to, make, make)
+ BOOST_PROTO_BINARY_DEFAULT_EVAL(||, logical_or, make, make)
+ BOOST_PROTO_BINARY_DEFAULT_EVAL(&&, logical_and, make, make)
+ BOOST_PROTO_BINARY_DEFAULT_EVAL(&, bitwise_and, make, make)
+ BOOST_PROTO_BINARY_DEFAULT_EVAL(|, bitwise_or, make, make)
+ BOOST_PROTO_BINARY_DEFAULT_EVAL(^, bitwise_xor, make, make)
+
+ BOOST_PROTO_BINARY_DEFAULT_EVAL(=, assign, make_mutable, make)
+ BOOST_PROTO_BINARY_DEFAULT_EVAL(<<=, shift_left_assign, make_mutable, make)
+ BOOST_PROTO_BINARY_DEFAULT_EVAL(>>=, shift_right_assign, make_mutable, make)
+ BOOST_PROTO_BINARY_DEFAULT_EVAL(*=, multiplies_assign, make_mutable, make)
+ BOOST_PROTO_BINARY_DEFAULT_EVAL(/=, divides_assign, make_mutable, make)
+ BOOST_PROTO_BINARY_DEFAULT_EVAL(%=, modulus_assign, make_mutable, make)
+ BOOST_PROTO_BINARY_DEFAULT_EVAL(+=, plus_assign, make_mutable, make)
+ BOOST_PROTO_BINARY_DEFAULT_EVAL(-=, minus_assign, make_mutable, make)
+ BOOST_PROTO_BINARY_DEFAULT_EVAL(&=, bitwise_and_assign, make_mutable, make)
+ BOOST_PROTO_BINARY_DEFAULT_EVAL(|=, bitwise_or_assign, make_mutable, make)
+ BOOST_PROTO_BINARY_DEFAULT_EVAL(^=, bitwise_xor_assign, make_mutable, make)
 
- #undef BOOST_PROTO_UNARY_OP_RESULT
- #undef BOOST_PROTO_BINARY_OP_RESULT
+ #undef BOOST_PROTO_UNARY_DEFAULT_EVAL
+ #undef BOOST_PROTO_BINARY_DEFAULT_EVAL
 
             /// INTERNAL ONLY
- template<typename Expr, typename State, typename Data>
+ template<typename Grammar, typename Expr, typename State, typename Data>
             struct is_member_function_invocation
               : is_member_function_pointer<
                     typename remove_const<
@@ -152,8 +184,8 @@
             {};
 
             /// INTERNAL ONLY
- template<typename Expr, typename State, typename Data, bool IsMemFunCall>
- struct memfun_impl
+ template<typename Grammar, typename Expr, typename State, typename Data, bool IsMemFunCall>
+ struct default_mem_ptr_impl
               : transform_impl<Expr, State, Data>
             {
             private:
@@ -164,9 +196,9 @@
             public:
                 typedef typename detail::mem_ptr_fun<r0, r1>::result_type result_type;
                 result_type operator ()(
- typename memfun_impl::expr_param e
- , typename memfun_impl::state_param s
- , typename memfun_impl::data_param d
+ typename default_mem_ptr_impl::expr_param e
+ , typename default_mem_ptr_impl::state_param s
+ , typename default_mem_ptr_impl::data_param d
                 ) const
                 {
                     typename Grammar::template impl<e0, State, Data> t0;
@@ -179,8 +211,8 @@
             };
 
             /// INTERNAL ONLY
- template<typename Expr, typename State, typename Data>
- struct memfun_impl<Expr, State, Data, true>
+ template<typename Grammar, typename Expr, typename State, typename Data>
+ struct default_mem_ptr_impl<Grammar, Expr, State, Data, true>
               : transform_impl<Expr, State, Data>
             {
             private:
@@ -191,9 +223,9 @@
             public:
                 typedef detail::memfun<r0, r1> result_type;
                 result_type const operator ()(
- typename memfun_impl::expr_param e
- , typename memfun_impl::state_param s
- , typename memfun_impl::data_param d
+ typename default_mem_ptr_impl::expr_param e
+ , typename default_mem_ptr_impl::state_param s
+ , typename default_mem_ptr_impl::data_param d
                 ) const
                 {
                     typename Grammar::template impl<e0, State, Data> t0;
@@ -205,155 +237,245 @@
                 }
             };
 
- template<typename Expr, typename State, typename Data>
- struct impl2<Expr, State, Data, tag::mem_ptr, 2>
- : memfun_impl<Expr, State, Data, is_member_function_invocation<Expr, State, Data>::value>
+ template<typename Grammar>
+ struct default_mem_ptr
+ : transform<default_mem_ptr<Grammar> >
+ {
+ template<typename Expr, typename State, typename Data>
+ struct impl
+ : default_mem_ptr_impl<
+ Grammar
+ , Expr
+ , State
+ , Data
+ , is_member_function_invocation<Grammar, Expr, State, Data>::value
+ >
+ {};
+ };
+
+ template<typename Grammar>
+ struct default_case<Grammar, tag::mem_ptr>
+ : when<mem_ptr<Grammar, Grammar>, default_mem_ptr<Grammar> >
             {};
 
- template<typename Expr, typename State, typename Data>
- struct impl2<Expr, State, Data, tag::post_inc, 1>
- : transform_impl<Expr, State, Data>
- {
- private:
- typedef typename result_of::child_c<Expr, 0>::type e0;
- typedef typename Grammar::template impl<e0, State, Data>::result_type r0;
- public:
- BOOST_PROTO_DECLTYPE_(proto::detail::make_mutable<r0>() ++, result_type)
- result_type operator ()(
- typename impl2::expr_param e
- , typename impl2::state_param s
- , typename impl2::data_param d
- ) const
- {
- typename Grammar::template impl<e0, State, Data> t0;
- return t0(proto::child_c<0>(e), s, d) ++;
- }
+ template<typename Grammar>
+ struct default_post_inc
+ : transform<default_post_inc<Grammar> >
+ {
+ template<typename Expr, typename State, typename Data>
+ struct impl
+ : transform_impl<Expr, State, Data>
+ {
+ private:
+ typedef typename result_of::child_c<Expr, 0>::type e0;
+ typedef typename Grammar::template impl<e0, State, Data>::result_type r0;
+ public:
+ BOOST_PROTO_DECLTYPE_(proto::detail::make_mutable<r0>() ++, result_type)
+ result_type operator ()(
+ typename impl::expr_param e
+ , typename impl::state_param s
+ , typename impl::data_param d
+ ) const
+ {
+ typename Grammar::template impl<e0, State, Data> t0;
+ return t0(proto::child_c<0>(e), s, d) ++;
+ }
+ };
             };
 
- template<typename Expr, typename State, typename Data>
- struct impl2<Expr, State, Data, tag::post_dec, 1>
- : transform_impl<Expr, State, Data>
- {
- private:
- typedef typename result_of::child_c<Expr, 0>::type e0;
- typedef typename Grammar::template impl<e0, State, Data>::result_type r0;
- public:
- BOOST_PROTO_DECLTYPE_(proto::detail::make_mutable<r0>() --, result_type)
- result_type operator ()(
- typename impl2::expr_param e
- , typename impl2::state_param s
- , typename impl2::data_param d
- ) const
- {
- typename Grammar::template impl<e0, State, Data> t0;
- return t0(proto::child_c<0>(e), s, d) --;
- }
+ template<typename Grammar>
+ struct default_case<Grammar, tag::post_inc>
+ : when<post_inc<Grammar>, default_post_inc<Grammar> >
+ {};
+
+ template<typename Grammar>
+ struct default_post_dec
+ : transform<default_post_dec<Grammar> >
+ {
+ template<typename Expr, typename State, typename Data>
+ struct impl
+ : transform_impl<Expr, State, Data>
+ {
+ private:
+ typedef typename result_of::child_c<Expr, 0>::type e0;
+ typedef typename Grammar::template impl<e0, State, Data>::result_type r0;
+ public:
+ BOOST_PROTO_DECLTYPE_(proto::detail::make_mutable<r0>() --, result_type)
+ result_type operator ()(
+ typename impl::expr_param e
+ , typename impl::state_param s
+ , typename impl::data_param d
+ ) const
+ {
+ typename Grammar::template impl<e0, State, Data> t0;
+ return t0(proto::child_c<0>(e), s, d) --;
+ }
+ };
             };
 
- template<typename Expr, typename State, typename Data>
- struct impl2<Expr, State, Data, tag::subscript, 2>
- : transform_impl<Expr, State, Data>
- {
- private:
- typedef typename result_of::child_c<Expr, 0>::type e0;
- typedef typename result_of::child_c<Expr, 1>::type e1;
- typedef typename Grammar::template impl<e0, State, Data>::result_type r0;
- typedef typename Grammar::template impl<e1, State, Data>::result_type r1;
- public:
- BOOST_PROTO_DECLTYPE_(
- proto::detail::make_subscriptable<r0>() [ proto::detail::make<r1>() ]
- , result_type
- )
- result_type operator ()(
- typename impl2::expr_param e
- , typename impl2::state_param s
- , typename impl2::data_param d
- ) const
- {
- typename Grammar::template impl<e0, State, Data> t0;
- typename Grammar::template impl<e1, State, Data> t1;
- return t0(proto::child_c<0>(e), s, d) [
- t1(proto::child_c<1>(e), s, d) ];
- }
+ template<typename Grammar>
+ struct default_case<Grammar, tag::post_dec>
+ : when<post_dec<Grammar>, default_post_dec<Grammar> >
+ {};
+
+ template<typename Grammar>
+ struct default_subscript
+ : transform<default_subscript<Grammar> >
+ {
+ template<typename Expr, typename State, typename Data>
+ struct impl
+ : transform_impl<Expr, State, Data>
+ {
+ private:
+ typedef typename result_of::child_c<Expr, 0>::type e0;
+ typedef typename result_of::child_c<Expr, 1>::type e1;
+ typedef typename Grammar::template impl<e0, State, Data>::result_type r0;
+ typedef typename Grammar::template impl<e1, State, Data>::result_type r1;
+ public:
+ BOOST_PROTO_DECLTYPE_(
+ proto::detail::make_subscriptable<r0>() [ proto::detail::make<r1>() ]
+ , result_type
+ )
+ result_type operator ()(
+ typename impl::expr_param e
+ , typename impl::state_param s
+ , typename impl::data_param d
+ ) const
+ {
+ typename Grammar::template impl<e0, State, Data> t0;
+ typename Grammar::template impl<e1, State, Data> t1;
+ return t0(proto::child_c<0>(e), s, d) [
+ t1(proto::child_c<1>(e), s, d) ];
+ }
+ };
             };
 
- template<typename Expr, typename State, typename Data>
- struct impl2<Expr, State, Data, tag::if_else_, 3>
- : transform_impl<Expr, State, Data>
+ template<typename Grammar>
+ struct default_case<Grammar, tag::subscript>
+ : when<subscript<Grammar, Grammar>, default_subscript<Grammar> >
+ {};
+
+ template<typename Grammar>
+ struct default_if_else_
             {
- private:
- typedef typename result_of::child_c<Expr, 0>::type e0;
- typedef typename result_of::child_c<Expr, 1>::type e1;
- typedef typename result_of::child_c<Expr, 2>::type e2;
- typedef typename Grammar::template impl<e0, State, Data>::result_type r0;
- typedef typename Grammar::template impl<e1, State, Data>::result_type r1;
- typedef typename Grammar::template impl<e2, State, Data>::result_type r2;
- public:
- BOOST_PROTO_DECLTYPE_(
- proto::detail::make<r0>()
- ? proto::detail::make<r1>()
- : proto::detail::make<r2>()
- , result_type
- )
- result_type operator ()(
- typename impl2::expr_param e
- , typename impl2::state_param s
- , typename impl2::data_param d
- ) const
- {
- typename Grammar::template impl<e0, State, Data> t0;
- typename Grammar::template impl<e1, State, Data> t1;
- typename Grammar::template impl<e2, State, Data> t2;
- return t0(proto::child_c<0>(e), s, d)
- ? t1(proto::child_c<1>(e), s, d)
- : t2(proto::child_c<2>(e), s, d);
- }
+ template<typename Expr, typename State, typename Data>
+ struct impl
+ : transform_impl<Expr, State, Data>
+ {
+ private:
+ typedef typename result_of::child_c<Expr, 0>::type e0;
+ typedef typename result_of::child_c<Expr, 1>::type e1;
+ typedef typename result_of::child_c<Expr, 2>::type e2;
+ typedef typename Grammar::template impl<e0, State, Data>::result_type r0;
+ typedef typename Grammar::template impl<e1, State, Data>::result_type r1;
+ typedef typename Grammar::template impl<e2, State, Data>::result_type r2;
+ public:
+ BOOST_PROTO_DECLTYPE_(
+ proto::detail::make<r0>()
+ ? proto::detail::make<r1>()
+ : proto::detail::make<r2>()
+ , result_type
+ )
+ result_type operator ()(
+ typename impl::expr_param e
+ , typename impl::state_param s
+ , typename impl::data_param d
+ ) const
+ {
+ typename Grammar::template impl<e0, State, Data> t0;
+ typename Grammar::template impl<e1, State, Data> t1;
+ typename Grammar::template impl<e2, State, Data> t2;
+ return t0(proto::child_c<0>(e), s, d)
+ ? t1(proto::child_c<1>(e), s, d)
+ : t2(proto::child_c<2>(e), s, d);
+ }
+ };
             };
 
- template<typename Expr, typename State, typename Data>
- struct impl2<Expr, State, Data, tag::comma, 2>
- : transform_impl<Expr, State, Data>
- {
- private:
- typedef typename result_of::child_c<Expr, 0>::type e0;
- typedef typename result_of::child_c<Expr, 1>::type e1;
- typedef typename Grammar::template impl<e0, State, Data>::result_type r0;
- typedef typename Grammar::template impl<e1, State, Data>::result_type r1;
- public:
- typedef typename proto::detail::comma_result<r0, r1>::type result_type;
- result_type operator ()(
- typename impl2::expr_param e
- , typename impl2::state_param s
- , typename impl2::data_param d
- ) const
- {
- typename Grammar::template impl<e0, State, Data> t0;
- typename Grammar::template impl<e1, State, Data> t1;
- return t0(proto::child_c<0>(e), s, d)
- , t1(proto::child_c<1>(e), s, d);
- }
+ template<typename Grammar>
+ struct default_case<Grammar, tag::if_else_>
+ : when<if_else_<Grammar, Grammar, Grammar>, default_if_else_<Grammar> >
+ {};
+
+ template<typename Grammar>
+ struct default_comma
+ : transform<default_comma<Grammar> >
+ {
+ template<typename Expr, typename State, typename Data>
+ struct impl
+ : transform_impl<Expr, State, Data>
+ {
+ private:
+ typedef typename result_of::child_c<Expr, 0>::type e0;
+ typedef typename result_of::child_c<Expr, 1>::type e1;
+ typedef typename Grammar::template impl<e0, State, Data>::result_type r0;
+ typedef typename Grammar::template impl<e1, State, Data>::result_type r1;
+ public:
+ typedef typename proto::detail::comma_result<r0, r1>::type result_type;
+ result_type operator ()(
+ typename impl::expr_param e
+ , typename impl::state_param s
+ , typename impl::data_param d
+ ) const
+ {
+ typename Grammar::template impl<e0, State, Data> t0;
+ typename Grammar::template impl<e1, State, Data> t1;
+ return t0(proto::child_c<0>(e), s, d)
+ , t1(proto::child_c<1>(e), s, d);
+ }
+ };
+ };
+
+ template<typename Grammar>
+ struct default_case<Grammar, tag::comma>
+ : when<comma<Grammar, Grammar>, default_comma<Grammar> >
+ {};
+
+ template<typename Grammar, typename Expr, typename State, typename Data, long Arity>
+ struct default_function_impl;
+
+ template<typename Grammar>
+ struct default_function
+ : transform<default_function<Grammar> >
+ {
+ template<typename Expr, typename State, typename Data>
+ struct impl
+ : default_function_impl<
+ Grammar
+ , Expr
+ , State
+ , Data
+ , transform_impl<Expr, State, Data>::expr::proto_arity_c
+ >
+ {};
             };
 
- #define EVAL_TYPE(Z, N, DATA) \
+ template<typename Grammar>
+ struct default_case<Grammar, tag::function>
+ : when<function<Grammar, vararg<Grammar> >, default_function<Grammar> >
+ {};
+
+ #define BOOST_PROTO_DEFAULT_EVAL_TYPE(Z, N, DATA) \
                 typedef \
                     typename result_of::child_c<DATA, N>::type \
                 BOOST_PP_CAT(e, N); \
+ \
                 typedef \
                     typename Grammar::template impl<BOOST_PP_CAT(e, N), State, Data>::result_type \
                 BOOST_PP_CAT(r, N); \
                 /**/
 
- #define EVAL(Z, N, DATA) \
+ #define BOOST_PROTO_DEFAULT_EVAL(Z, N, DATA) \
                 typename Grammar::template impl<BOOST_PP_CAT(e, N), State, Data>()( \
- proto::child_c<N>(DATA), s, d \
+ proto::child_c<N>(DATA), s, d \
                 ) \
                 /**/
 
- template<typename Expr, typename State, typename Data>
- struct impl2<Expr, State, Data, tag::function, 1>
+ template<typename Grammar, typename Expr, typename State, typename Data>
+ struct default_function_impl<Grammar, Expr, State, Data, 1>
               : transform_impl<Expr, State, Data>
             {
- EVAL_TYPE(~, 0, Expr)
+ BOOST_PROTO_DEFAULT_EVAL_TYPE(~, 0, Expr)
 
                 typedef
                     typename proto::detail::result_of_fixup<r0>::type
@@ -364,21 +486,21 @@
                 result_type;
 
                 result_type operator ()(
- typename impl2::expr_param e
- , typename impl2::state_param s
- , typename impl2::data_param d
+ typename default_function_impl::expr_param e
+ , typename default_function_impl::state_param s
+ , typename default_function_impl::data_param d
                 ) const
                 {
- return EVAL(~, 0, e)();
+ return BOOST_PROTO_DEFAULT_EVAL(~, 0, e)();
                 }
             };
 
- template<typename Expr, typename State, typename Data>
- struct impl2<Expr, State, Data, tag::function, 2>
+ template<typename Grammar, typename Expr, typename State, typename Data>
+ struct default_function_impl<Grammar, Expr, State, Data, 2>
               : transform_impl<Expr, State, Data>
             {
- EVAL_TYPE(~, 0, Expr)
- EVAL_TYPE(~, 1, Expr)
+ BOOST_PROTO_DEFAULT_EVAL_TYPE(~, 0, Expr)
+ BOOST_PROTO_DEFAULT_EVAL_TYPE(~, 1, Expr)
 
                 typedef
                     typename proto::detail::result_of_fixup<r0>::type
@@ -389,9 +511,9 @@
                 result_type;
 
                 result_type operator ()(
- typename impl2::expr_param e
- , typename impl2::state_param s
- , typename impl2::data_param d
+ typename default_function_impl::expr_param e
+ , typename default_function_impl::state_param s
+ , typename default_function_impl::data_param d
                 ) const
                 {
                     return this->invoke(
@@ -405,60 +527,60 @@
 
             private:
                 result_type invoke(
- typename impl2::expr_param e
- , typename impl2::state_param s
- , typename impl2::data_param d
+ typename default_function_impl::expr_param e
+ , typename default_function_impl::state_param s
+ , typename default_function_impl::data_param d
                   , mpl::false_
                   , mpl::false_
                 ) const
                 {
- return EVAL(~, 0, e)(EVAL(~, 1, e));
+ return BOOST_PROTO_DEFAULT_EVAL(~, 0, e)(BOOST_PROTO_DEFAULT_EVAL(~, 1, e));
                 }
 
                 result_type invoke(
- typename impl2::expr_param e
- , typename impl2::state_param s
- , typename impl2::data_param d
+ typename default_function_impl::expr_param e
+ , typename default_function_impl::state_param s
+ , typename default_function_impl::data_param d
                   , mpl::true_
                   , mpl::false_
                 ) const
                 {
                     BOOST_PROTO_USE_GET_POINTER();
                     typedef typename detail::classtypeof<function_type>::type class_type;
- return (BOOST_PROTO_GET_POINTER(class_type, EVAL(~, 1, e)) ->* EVAL(~, 0, e))();
+ return (
+ BOOST_PROTO_GET_POINTER(class_type, BOOST_PROTO_DEFAULT_EVAL(~, 1, e)) ->*
+ BOOST_PROTO_DEFAULT_EVAL(~, 0, e)
+ )();
                 }
 
                 result_type invoke(
- typename impl2::expr_param e
- , typename impl2::state_param s
- , typename impl2::data_param d
+ typename default_function_impl::expr_param e
+ , typename default_function_impl::state_param s
+ , typename default_function_impl::data_param d
                   , mpl::false_
                   , mpl::true_
                 ) const
                 {
                     BOOST_PROTO_USE_GET_POINTER();
                     typedef typename detail::classtypeof<function_type>::type class_type;
- return (BOOST_PROTO_GET_POINTER(class_type, EVAL(~, 1, e)) ->* EVAL(~, 0, e));
+ return (
+ BOOST_PROTO_GET_POINTER(class_type, BOOST_PROTO_DEFAULT_EVAL(~, 1, e)) ->*
+ BOOST_PROTO_DEFAULT_EVAL(~, 0, e)
+ );
                 }
             };
 
             #define BOOST_PP_ITERATION_PARAMS_1 (3, (3, BOOST_PROTO_MAX_ARITY, <boost/proto/transform/default.hpp>))
             #include BOOST_PP_ITERATE()
 
- #undef EVAL_TYPE
- #undef EVAL
+ #undef BOOST_PROTO_DEFAULT_EVAL_TYPE
+ #undef BOOST_PROTO_DEFAULT_EVAL
+ }
 
- template<typename Expr, typename State, typename Data>
- struct impl
- : impl2<
- Expr
- , State
- , Data
- , typename transform_impl<Expr, State, Data>::expr::proto_tag
- , transform_impl<Expr, State, Data>::expr::proto_arity_c
- >
- {};
- };
+ template<typename Grammar /*= detail::_default*/>
+ struct _default
+ : switch_<detail::default_cases<Grammar> >
+ {};
 
         template<typename Grammar>
         struct is_callable<_default<Grammar> >
@@ -482,11 +604,11 @@
 
     #define N BOOST_PP_ITERATION()
 
- template<typename Expr, typename State, typename Data>
- struct impl2<Expr, State, Data, tag::function, N>
+ template<typename Grammar, typename Expr, typename State, typename Data>
+ struct default_function_impl<Grammar, Expr, State, Data, N>
           : transform_impl<Expr, State, Data>
         {
- BOOST_PP_REPEAT(N, EVAL_TYPE, Expr)
+ BOOST_PP_REPEAT(N, BOOST_PROTO_DEFAULT_EVAL_TYPE, Expr)
 
             typedef
                 typename proto::detail::result_of_fixup<r0>::type
@@ -499,9 +621,9 @@
             result_type;
 
             result_type operator ()(
- typename impl2::expr_param e
- , typename impl2::state_param s
- , typename impl2::data_param d
+ typename default_function_impl::expr_param e
+ , typename default_function_impl::state_param s
+ , typename default_function_impl::data_param d
             ) const
             {
                 return this->invoke(e, s, d, is_member_function_pointer<function_type>());
@@ -509,28 +631,31 @@
 
         private:
             result_type invoke(
- typename impl2::expr_param e
- , typename impl2::state_param s
- , typename impl2::data_param d
+ typename default_function_impl::expr_param e
+ , typename default_function_impl::state_param s
+ , typename default_function_impl::data_param d
               , mpl::false_
             ) const
             {
- return EVAL(~, 0, e)(BOOST_PP_ENUM_SHIFTED(N, EVAL, e));
+ return BOOST_PROTO_DEFAULT_EVAL(~, 0, e)(
+ BOOST_PP_ENUM_SHIFTED(N, BOOST_PROTO_DEFAULT_EVAL, e)
+ );
             }
 
             result_type invoke(
- typename impl2::expr_param e
- , typename impl2::state_param s
- , typename impl2::data_param d
+ typename default_function_impl::expr_param e
+ , typename default_function_impl::state_param s
+ , typename default_function_impl::data_param d
               , mpl::true_
             ) const
             {
- #define M0(Z, M, e) BOOST_PP_COMMA_IF(BOOST_PP_SUB(M, 2)) EVAL(Z, M, e)
+ #define M0(Z, M, DATA) BOOST_PROTO_DEFAULT_EVAL(Z, BOOST_PP_ADD(M, 2), DATA)
                 BOOST_PROTO_USE_GET_POINTER();
                 typedef typename detail::classtypeof<function_type>::type class_type;
- return (BOOST_PROTO_GET_POINTER(class_type, EVAL(~, 1, e)) ->* EVAL(~, 0, e))(
- BOOST_PP_REPEAT_FROM_TO(2, N, M0, e)
- );
+ return (
+ BOOST_PROTO_GET_POINTER(class_type, BOOST_PROTO_DEFAULT_EVAL(~, 1, e)) ->*
+ BOOST_PROTO_DEFAULT_EVAL(~, 0, e)
+ )(BOOST_PP_ENUM(BOOST_PP_SUB(N, 2), M0, e));
                 #undef M0
             }
         };

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 2010-05-22 02:17:55 EDT (Sat, 22 May 2010)
@@ -41,7 +41,8 @@
                     typename result_of::child_c<Expr, N>::type \
                   , State \
                   , Data \
- >::result_type
+ >::result_type \
+ /**/
 
             #define BOOST_PROTO_DEFINE_TRANSFORM(Z, N, DATA) \
                 typename Grammar::BOOST_PP_CAT(proto_child, N)::template impl< \
@@ -49,8 +50,9 @@
                   , State \
                   , Data \
>()( \
- e.proto_base().BOOST_PP_CAT(child, N), s, d \
- )
+ e.proto_base().BOOST_PP_CAT(child, N), s, d \
+ ) \
+ /**/
 
             #define BOOST_PP_ITERATION_PARAMS_1 (3, (1, BOOST_PROTO_MAX_ARITY, <boost/proto/transform/pass_through.hpp>))
             #include BOOST_PP_ITERATE()
@@ -70,7 +72,7 @@
                 #ifndef BOOST_NO_DECLTYPE
                 result_type
                 #else
- typename pass_through_impl::expr_param
+ typename pass_through_impl::expr_param
                 #endif
                 operator()(
                     typename pass_through_impl::expr_param e
@@ -163,21 +165,26 @@
             struct pass_through_impl<Grammar, Expr, State, Data, N>
               : transform_impl<Expr, State, Data>
             {
+ typedef typename pass_through_impl::expr unref_expr;
+
                 typedef proto::expr<
- typename remove_reference<Expr>::type::proto_tag
+ typename unref_expr::proto_tag
                   , BOOST_PP_CAT(list, N)<
                         BOOST_PP_ENUM(N, BOOST_PROTO_DEFINE_TRANSFORM_TYPE, ~)
>
                   , N
- > result_type;
+ > expr_type;
+
+ typedef typename unref_expr::proto_domain proto_domain;
+ typedef typename boost::result_of<proto_domain(expr_type)>::type result_type;
 
- result_type operator ()(
+ 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
                 ) const
                 {
- result_type that = {
+ expr_type const that = {
                         BOOST_PP_ENUM(N, BOOST_PROTO_DEFINE_TRANSFORM, ~)
                     };
                     #if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1400))
@@ -186,7 +193,7 @@
                     // built with VC8.
                     &that;
                     #endif
- return that;
+ return proto_domain()(that);
                 }
             };
 

Modified: branches/release/libs/proto/doc/back_end.qbk
==============================================================================
--- branches/release/libs/proto/doc/back_end.qbk (original)
+++ branches/release/libs/proto/doc/back_end.qbk 2010-05-22 02:17:55 EDT (Sat, 22 May 2010)
@@ -1248,8 +1248,8 @@
       [For the specified set of alternate sub-grammars, find the one that matches
        the given expression and apply its associated transform.]]
  [[_and_]
- [For the given set of sub-grammars, take the /last/ sub-grammar and apply its
- associated transform.]]
+ [For the given set of sub-grammars, apply all the associated transforms and
+ return the result of the last.]]
  [[_not_]
       [Return the current expression unmodified.]]
  [[_if_]

Modified: branches/release/libs/proto/doc/reference.xml
==============================================================================
--- branches/release/libs/proto/doc/reference.xml (original)
+++ branches/release/libs/proto/doc/reference.xml 2010-05-22 02:17:55 EDT (Sat, 22 May 2010)
@@ -52,6 +52,11 @@
       </listitem>
       <listitem>
         <computeroutput>
+ <classname alt="boost::proto::_void">proto::_void</classname>
+ </computeroutput>
+ </listitem>
+ <listitem>
+ <computeroutput>
           <classname alt="boost::proto::address_of">proto::address_of</classname>
         </computeroutput>
       </listitem>

Modified: branches/release/libs/proto/doc/reference/matches.xml
==============================================================================
--- branches/release/libs/proto/doc/reference/matches.xml (original)
+++ branches/release/libs/proto/doc/reference/matches.xml 2010-05-22 02:17:55 EDT (Sat, 22 May 2010)
@@ -358,7 +358,7 @@
         <inherit><type><classname>proto::transform</classname>&lt;and_&lt;G...&gt; &gt;</type></inherit>
         <purpose>For matching all of a set of grammars. When used as a transform,
           <computeroutput>proto::and_&lt;&gt;</computeroutput> applies the transform associated
- with the <emphasis>last</emphasis> grammar in the set.</purpose>
+ with each grammar in the set and returns the result of the last.</purpose>
         <description>
           <para>
             An expression type <computeroutput>E</computeroutput> matches
@@ -371,7 +371,7 @@
             <computeroutput>proto::and_&lt;G<subscript>0</subscript>,G<subscript>1</subscript>,...G<subscript>n</subscript>&gt;</computeroutput>
             as a transform with an expression <computeroutput>e</computeroutput>, state
             <computeroutput>s</computeroutput> and data <computeroutput>d</computeroutput>, it is equivalent
- to <computeroutput>G<subscript>n</subscript>()(e, s, d)</computeroutput>.
+ to <computeroutput>(G<subscript>0</subscript>()(e, s, d),G<subscript>1</subscript>()(e, s, d),...G<subscript>n</subscript>()(e, s, d))</computeroutput>.
           </para>
           <para>
             The maximun number of template arguments <computeroutput>proto::and_&lt;&gt;</computeroutput> accepts
@@ -412,7 +412,7 @@
               </parameter>
               <returns>
                 <para>
- <computeroutput>G<subscript>n</subscript>()(expr, state, data)</computeroutput>
+ <computeroutput>(G<subscript>0</subscript>()(expr, state, data),G<subscript>1</subscript>()(expr, state, data),...G<subscript>n</subscript>()(expr, state, data))</computeroutput>
                 </para>
               </returns>
             </method>

Modified: branches/release/libs/proto/doc/reference/transform/arg.xml
==============================================================================
--- branches/release/libs/proto/doc/reference/transform/arg.xml (original)
+++ branches/release/libs/proto/doc/reference/transform/arg.xml 2010-05-22 02:17:55 EDT (Sat, 22 May 2010)
@@ -289,6 +289,44 @@
         </struct>
       </struct>
 
+ <struct name="_void">
+ <inherit><classname>proto::transform</classname>&lt; _void &gt;</inherit>
+ <purpose>A <conceptname>PrimitiveTransform</conceptname> that does nothing and returns void. </purpose>
+ <struct name="impl">
+ <template>
+ <template-type-parameter name="Expr"/>
+ <template-type-parameter name="State"/>
+ <template-type-parameter name="Data"/>
+ </template>
+ <inherit><classname>proto::transform_impl</classname>&lt; Expr, State, Data &gt;</inherit>
+ <typedef name="result_type">
+ <type>void</type>
+ </typedef>
+ <method-group name="public member functions">
+ <method name="operator()" cv="const">
+ <type>void</type>
+ <parameter name="">
+ <paramtype>typename impl::expr_param</paramtype>
+ </parameter>
+ <parameter name="">
+ <paramtype>typename impl::state_param</paramtype>
+ </parameter>
+ <parameter name="">
+ <paramtype>typename impl::data_param</paramtype>
+ </parameter>
+ <description>
+ <para>
+ Does nothing.
+ </para>
+ </description>
+ <throws>
+ <simpara>Will not throw.</simpara>
+ </throws>
+ </method>
+ </method-group>
+ </struct>
+ </struct>
+
       <struct name="_byref">
         <inherit><classname>proto::callable</classname></inherit>
         <purpose>A unary callable <conceptname>PolymorphicFunctionObject</conceptname> that wraps its argument

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 2010-05-22 02:17:55 EDT (Sat, 22 May 2010)
@@ -100,9 +100,17 @@
             <purpose>For exposition only</purpose>
             <type>typename Expr::proto_tag</type>
           </typedef>
- <typedef name="result_type">
+ <typedef name="D">
+ <purpose>For exposition only</purpose>
+ <type>typename Expr::proto_domain</type>
+ </typedef>
+ <typedef name="expr_type">
+ <purpose>For exposition only</purpose>
             <type><classname>proto::expr</classname>&lt;T, <classname>proto::listN</classname>&lt;R0,...RN&gt; &gt;</type>
           </typedef>
+ <typedef name="result_type">
+ <type>typename boost::result_of&lt;D(expr_type)&gt;::type</type>
+ </typedef>
           <method-group name="public member functions">
             <method name="operator()" cv="const">
               <type>result_type</type>
@@ -124,11 +132,11 @@
               </requires>
               <returns>
                 <para>
- <programlisting>result_type::make(
+ <programlisting>D()(expr_type::make(
   G0()(<functionname>proto::child_c</functionname>&lt;0&gt;(expr), state, data),
   ...
   GN()(<functionname>proto::child_c</functionname>&lt;N&gt;(expr), state, data)
-)</programlisting>
+))</programlisting>
                 </para>
               </returns>
             </method>

Modified: branches/release/libs/proto/doc/release_notes.qbk
==============================================================================
--- branches/release/libs/proto/doc/release_notes.qbk (original)
+++ branches/release/libs/proto/doc/release_notes.qbk 2010-05-22 02:17:55 EDT (Sat, 22 May 2010)
@@ -8,6 +8,21 @@
 [section:release_notes Appendix A: Release Notes]
 
 [/=================]
+[heading Boost 1.44]
+[/=================]
+
+In Boost 1.44, the behavior of _and_ as a transform changed. Previously, it only
+applied the transform associated with the last grammar in the set. Now, it applies
+all the transforms but only returns the result of the last. That makes it behave
+like C++'s comma operator. For example, a grammar such as:
+
+ proto::and_< G0, G1, G2 >
+
+when evaluated with an expression `e` now behaves like this:
+
+ (G0()(e), G1()(e), G2()(e))
+
+[/=================]
 [heading Boost 1.43]
 [/=================]
 


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