$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
From: eric_at_[hidden]
Date: 2007-12-02 14:45:40
Author: eric_niebler
Date: 2007-12-02 14:45:39 EST (Sun, 02 Dec 2007)
New Revision: 41591
URL: http://svn.boost.org/trac/boost/changeset/41591
Log:
apply transform unnecessary, removed.
Removed:
   branches/proto/v3/boost/xpressive/proto/transform/apply.hpp
Text files modified: 
   branches/proto/v3/boost/xpressive/detail/static/grammar.hpp |    13 ++--                                    
   branches/proto/v3/boost/xpressive/proto/transform.hpp       |     1                                         
   branches/proto/v3/boost/xpressive/proto/transform/call.hpp  |   106 ++++++++++++++++++++++----------------- 
   branches/proto/v3/boost/xpressive/proto/transform/when.hpp  |     5 -                                       
   4 files changed, 67 insertions(+), 58 deletions(-)
Modified: branches/proto/v3/boost/xpressive/detail/static/grammar.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/detail/static/grammar.hpp	(original)
+++ branches/proto/v3/boost/xpressive/detail/static/grammar.hpp	2007-12-02 14:45:39 EST (Sun, 02 Dec 2007)
@@ -485,11 +485,11 @@
 
             // Here are some transforms ...
             struct as_independent
-              : apply<Gram, _make_shift_right(_, true_matcher()), no_next()>
+              : call<Gram(_make_shift_right(_, true_matcher()), no_next())>
             {};
 
             struct as_alternate
-              : apply<Gram, _make_shift_right(_, alternate_end_matcher()), no_next()>
+              : call<Gram(_make_shift_right(_, alternate_end_matcher()), no_next())>
             {};
 
             struct as_alternates_list
@@ -540,7 +540,7 @@
 
             template<typename Greedy, typename Tag, uint_t = min_type<Tag>::value, uint_t = max_type<Tag>::value>
             struct as_default_repeat_impl
-              : apply<as_repeater<Greedy, Tag>, as_marker(add_hidden_mark(_arg))>
+              : call<as_repeater<Greedy, Tag>(as_marker(add_hidden_mark(_arg)))>
             {};
 
             template<typename Greedy, typename Tag, uint_t Max>
@@ -568,14 +568,13 @@
 
             template<typename Greedy>
             struct as_simple_repeat
-              : apply<
-                    _
-                  , simple_repeat_matcher<as_independent(_arg), Greedy>(
+              : call< // TODO add a make<> transform
+                    _(simple_repeat_matcher<as_independent(_arg), Greedy>(
                         as_independent(_arg)
                       , min_type<tag_of<_> >()
                       , max_type<tag_of<_> >()
                       , get_width(as_independent(_arg))
-                    )
+                    ))
                 >
             {};
 
Modified: branches/proto/v3/boost/xpressive/proto/transform.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto/transform.hpp	(original)
+++ branches/proto/v3/boost/xpressive/proto/transform.hpp	2007-12-02 14:45:39 EST (Sun, 02 Dec 2007)
@@ -9,7 +9,6 @@
 #ifndef BOOST_PROTO_TRANSFORM_HPP_EAN_10_29_2007
 #define BOOST_PROTO_TRANSFORM_HPP_EAN_10_29_2007
 
-#include <boost/xpressive/proto/transform/apply.hpp>
 #include <boost/xpressive/proto/transform/arg.hpp>
 #include <boost/xpressive/proto/transform/call.hpp>
 #include <boost/xpressive/proto/transform/fold.hpp>
Deleted: branches/proto/v3/boost/xpressive/proto/transform/apply.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto/transform/apply.hpp	2007-12-02 14:45:39 EST (Sun, 02 Dec 2007)
+++ (empty file)
@@ -1,125 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-/// \file apply.hpp
-/// Contains definition of the apply<> transform.
-//
-//  Copyright 2007 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_TRANSFORM_APPLY_HPP_EAN_11_02_2007
-#define BOOST_PROTO_TRANSFORM_APPLY_HPP_EAN_11_02_2007
-
-#include <boost/type_traits.hpp>
-#include <boost/utility/result_of.hpp>
-#include <boost/xpressive/proto/proto_fwd.hpp>
-#include <boost/xpressive/proto/traits.hpp>
-
-namespace boost { namespace proto
-{
-
-    namespace transform
-    {
-        template<typename T>
-        typename add_reference<T>::type as_lvalue(T &&t)
-        {
-            return t;
-        }
-
-        template<typename Trans>
-        struct apply<Trans>
-          : Trans
-        {};
-
-        template<typename Trans, typename ExprTfx>
-        struct apply<Trans, ExprTfx> : raw_transform
-        {
-            template<typename Sig>
-            struct result;
-
-            template<typename This, typename Expr, typename State, typename Visitor>
-            struct result<This(Expr, State, Visitor)>
-                : boost::result_of<Trans(
-                    typename boost::result_of<when<_, ExprTfx>(Expr, State, Visitor)>::type
-                  , State
-                  , Visitor
-                )>
-            {};
-
-            template<typename Expr, typename State, typename Visitor>
-            typename result<apply(Expr, State, Visitor)>::type
-            operator()(Expr const &expr, State const &state, Visitor &visitor) const
-            {
-                return Trans()(
-                    when<_, ExprTfx>()(expr, state, visitor)
-                  , state
-                  , visitor
-                );
-            }
-        };
-
-        template<typename Trans, typename ExprTfx, typename StateTfx>
-        struct apply<Trans, ExprTfx, StateTfx> : raw_transform
-        {
-            template<typename Sig>
-            struct result;
-
-            template<typename This, typename Expr, typename State, typename Visitor>
-            struct result<This(Expr, State, Visitor)>
-              : boost::result_of<Trans(
-                    typename boost::result_of<when<_, ExprTfx>(Expr, State, Visitor)>::type
-                  , typename boost::result_of<when<_, StateTfx>(Expr, State, Visitor)>::type
-                  , Visitor
-                )>
-            {};
-
-            template<typename Expr, typename State, typename Visitor>
-            typename result<apply(Expr, State, Visitor)>::type
-            operator()(Expr const &expr, State const &state, Visitor &visitor) const
-            {
-                return Trans()(
-                    when<_, ExprTfx>()(expr, state, visitor)
-                  , when<_, StateTfx>()(expr, state, visitor)
-                  , visitor
-                );
-            }
-        };
-
-        template<typename Trans, typename ExprTfx, typename StateTfx, typename VisitorTfx>
-        struct apply<Trans, ExprTfx, StateTfx, VisitorTfx> : raw_transform
-        {
-            template<typename Sig>
-            struct result;
-
-            template<typename This, typename Expr, typename State, typename Visitor>
-            struct result<This(Expr, State, Visitor)>
-              : boost::result_of<Trans(
-                    typename boost::result_of<when<_, ExprTfx>(Expr, State, Visitor)>::type
-                  , typename boost::result_of<when<_, StateTfx>(Expr, State, Visitor)>::type
-                  , typename boost::result_of<when<_, VisitorTfx>(Expr, State, Visitor)>::type
-                )>
-            {};
-
-            template<typename Expr, typename State, typename Visitor>
-            typename result<apply(Expr, State, Visitor)>::type
-            operator()(Expr const &expr, State const &state, Visitor &visitor) const
-            {
-                typedef typename boost::result_of<when<_, VisitorTfx>(Expr, State, Visitor)>::type visitor_type;
-                return Trans()(
-                    when<_, ExprTfx>()(expr, state, visitor)
-                  , when<_, StateTfx>()(expr, state, visitor)
-                  , const_cast<visitor_type &>(as_lvalue(when<_, VisitorTfx>()(expr, state, visitor)))
-                );
-            }
-        };
-
-    }
-
-    template<typename Trans, typename... Args>
-    struct transform_category<transform::apply<Trans, Args...> >
-    {
-        typedef raw_transform type;
-    };
-
-}}
-
-#endif
Modified: branches/proto/v3/boost/xpressive/proto/transform/call.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto/transform/call.hpp	(original)
+++ branches/proto/v3/boost/xpressive/proto/transform/call.hpp	2007-12-02 14:45:39 EST (Sun, 02 Dec 2007)
@@ -40,82 +40,96 @@
             yes_type check_fun_arity(T const &);
 
             no_type check_fun_arity(private_type_ const &);
-
+            
             template<typename Fun>
-            struct fun_wrap : Fun
+            struct callable1_wrap : Fun
             {
-                fun_wrap();
+                callable1_wrap();
                 typedef private_type_ const &(*pfun1)(dont_care);
-                typedef private_type_ const &(*pfun2)(dont_care, dont_care);
-                typedef private_type_ const &(*pfun3)(dont_care, dont_care, dont_care);
                 operator pfun1() const;
+            };
+
+            template<typename Fun>
+            struct callable2_wrap : Fun
+            {
+                callable2_wrap();
+                typedef private_type_ const &(*pfun2)(dont_care, dont_care);
                 operator pfun2() const;
-                operator pfun3() const;
             };
 
-            template<typename Fun, typename Expr, typename State, typename Visitor>
-            struct fun_arity
+            template<typename Fun, typename A0>
+            struct arity1
             {
-                static fun_wrap<Fun> &fun_;
-                static Expr &expr_;
-                static State &state_;
-                static Visitor &visitor_;
+                static callable1_wrap<Fun> &fun;
+                static A0 &a0;
 
                 static int const value =
-                    (sizeof(check_fun_arity((fun_(expr_), 0)))-1)? 1 :
-                    (sizeof(check_fun_arity((fun_(expr_, state_), 0)))-1)? 2 :
-                    (sizeof(check_fun_arity((fun_(expr_, state_, visitor_), 0)))-1)? 3 :
-                    -1;
+                    sizeof(yes_type) == sizeof(check_fun_arity((fun(a0), 0)))
+                  ? 1
+                  : 3;
             };
             
-            template<
-                typename Fun
-              , typename Expr
-              , typename State
-              , typename Visitor
-              , int Needs
-              , int Arity =
-                    (fun_arity<Fun, Expr, State, Visitor>::value > Needs) ?
-                    fun_arity<Fun, Expr, State, Visitor>::value : Needs
-            >
-            struct call_;
+            template<typename Fun, typename A0, typename A1>
+            struct arity2
+            {
+                static callable2_wrap<Fun> &fun;
+                static A0 &a0;
+                static A1 &a1;
 
-            template<typename Fun, typename Expr, typename State, typename Visitor, int Needs>
-            struct call_<Fun, Expr, State, Visitor, Needs, 1>
+                static int const value =
+                    sizeof(yes_type) == sizeof(check_fun_arity((fun(a0, a1), 0)))
+                  ? 2
+                  : 3;
+            };
+
+            template<typename Fun, typename Expr, typename State, typename Visitor>
+            struct call3
             {
-                typedef typename boost::result_of<Fun(Expr)>::type type;
+                typedef typename boost::result_of<Fun(Expr, State, Visitor)>::type type;
                 
                 template<typename A, typename B, typename C>
-                static type call(A &&expr, B &&, C &&)
+                static type call(A &&expr, B &&state, C &&visitor)
                 {
                     Fun f;
-                    return f(expr);
+                    return f(expr, state, visitor);
                 }
             };
+            
+            template<typename Fun, typename Expr, typename State, typename Visitor
+              , int Arity = arity1<Fun, Expr>::value>
+            struct call1
+              : call3<Fun, Expr, State, Visitor>
+            {};
 
-            template<typename Fun, typename Expr, typename State, typename Visitor, int Needs>
-            struct call_<Fun, Expr, State, Visitor, Needs, 2>
+            template<typename Fun, typename Expr, typename State, typename Visitor>
+            struct call1<Fun, Expr, State, Visitor, 1>
             {
-                typedef typename boost::result_of<Fun(Expr, State)>::type type;
+                typedef typename boost::result_of<Fun(Expr)>::type type;
                 
                 template<typename A, typename B, typename C>
-                static type call(A &&expr, B &&state, C &&)
+                static type call(A &&expr, B &&, C &&)
                 {
                     Fun f;
-                    return f(expr, state);
+                    return f(expr);
                 }
             };
-            
-            template<typename Fun, typename Expr, typename State, typename Visitor, int Needs>
-            struct call_<Fun, Expr, State, Visitor, Needs, 3>
+
+            template<typename Fun, typename Expr, typename State, typename Visitor
+              , int Arity = arity2<Fun, Expr, State>::value>
+            struct call2
+              : call3<Fun, Expr, State, Visitor>
+            {};
+
+            template<typename Fun, typename Expr, typename State, typename Visitor>
+            struct call2<Fun, Expr, State, Visitor, 2>
             {
-                typedef typename boost::result_of<Fun(Expr, State, Visitor)>::type type;
+                typedef typename boost::result_of<Fun(Expr, State)>::type type;
                 
                 template<typename A, typename B, typename C>
-                static type call(A &&expr, B &&state, C &&visitor)
+                static type call(A &&expr, B &&state, C &&)
                 {
                     Fun f;
-                    return f(expr, state, visitor);
+                    return f(expr, state);
                 }
             };
         }
@@ -150,12 +164,11 @@
 
             template<typename This, typename Expr, typename State, typename Visitor>
             struct result<This(Expr, State, Visitor)>
-              : detail::call_<
+              : detail::call1<
                     Fun
                   , typename boost::result_of<when<_, Arg0>(Expr, State, Visitor)>::type
                   , State
                   , Visitor
-                  , 1
                 >
             {};
 
@@ -179,12 +192,11 @@
 
             template<typename This, typename Expr, typename State, typename Visitor>
             struct result<This(Expr, State, Visitor)>
-              : detail::call_<
+              : detail::call2<
                     Fun
                   , typename boost::result_of<when<_, Arg0>(Expr, State, Visitor)>::type
                   , typename boost::result_of<when<_, Arg1>(Expr, State, Visitor)>::type
                   , Visitor
-                  , 2
                 >
             {};
 
Modified: branches/proto/v3/boost/xpressive/proto/transform/when.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto/transform/when.hpp	(original)
+++ branches/proto/v3/boost/xpressive/proto/transform/when.hpp	2007-12-02 14:45:39 EST (Sun, 02 Dec 2007)
@@ -18,7 +18,6 @@
 #include <boost/utility/enable_if.hpp>
 #include <boost/xpressive/proto/proto_fwd.hpp>
 #include <boost/xpressive/proto/transform/call.hpp>
-#include <boost/xpressive/proto/transform/apply.hpp>
 
 namespace boost { namespace proto
 {
@@ -251,12 +250,12 @@
             struct apply<Expr, State, Visitor, raw_transform, Return, Args...>
             {
                 typedef typename boost::result_of<
-                    transform::apply<Return, Args...>(Expr, State, Visitor)
+                    transform::call<Return, Args...>(Expr, State, Visitor)
                 >::type type;
 
                 static type call(Expr const &expr, State const &state, Visitor &visitor)
                 {
-                    return transform::apply<Return, Args...>()(expr, state, visitor);
+                    return transform::call<Return, Args...>()(expr, state, visitor);
                 }
             };