$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
From: joel_at_[hidden]
Date: 2008-04-17 19:59:34
Author: djowel
Date: 2008-04-17 19:59:34 EDT (Thu, 17 Apr 2008)
New Revision: 44524
URL: http://svn.boost.org/trac/boost/changeset/44524
Log:
action-dispatch
Added:
   trunk/boost/spirit/home/support/detail/action_dispatch.hpp   (contents, props changed)
Text files modified: 
   trunk/boost/spirit/home/qi/action/action.hpp |    13 +++++--------                           
   1 files changed, 5 insertions(+), 8 deletions(-)
Modified: trunk/boost/spirit/home/qi/action/action.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/action/action.hpp	(original)
+++ trunk/boost/spirit/home/qi/action/action.hpp	2008-04-17 19:59:34 EDT (Thu, 17 Apr 2008)
@@ -10,7 +10,7 @@
 #include <boost/spirit/home/qi/domain.hpp>
 #include <boost/spirit/home/support/component.hpp>
 #include <boost/spirit/home/support/attribute_of.hpp>
-#include <boost/spirit/home/support/detail/values.hpp>
+#include <boost/spirit/home/support/detail/action_dispatch.hpp>
 #include <boost/mpl/if.hpp>
 #include <boost/mpl/identity.hpp>
 #include <boost/type_traits/remove_const.hpp>
@@ -60,13 +60,10 @@
             if (director::parse(
                 spirit::left(component), first, last, context, skipper, attr))
             {
-                // call the function, passing the attribute, the context
-                // and a bool flag that the client can set to false to
-                // fail parsing.
-                bool pass = true;
-                spirit::right(component)(
-                    spirit::detail::pass_value<attr_type>::call(attr), context, pass);
-                return pass;
+                // call the function, passing the attribute, the context.
+                // The client can return false to fail parsing.
+                return spirit::detail::action_dispatch(
+                    spirit::right(component), attr, context);
             }
             return false;
         }
Added: trunk/boost/spirit/home/support/detail/action_dispatch.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/support/detail/action_dispatch.hpp	2008-04-17 19:59:34 EDT (Thu, 17 Apr 2008)
@@ -0,0 +1,41 @@
+/*=============================================================================
+    Copyright (c) 2001-2008 Joel de Guzman
+    Copyright (c) 2001-2008 Hartmut Kaiser
+    http://spirit.sourceforge.net/
+
+    Distributed under the Boost Software License, Version 1.0. (See accompanying
+    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+=============================================================================*/
+#if !defined(BOOST_SPIRIT_ACTION_DISPATCH_APR_18_2008_0720AM)
+#define BOOST_SPIRIT_ACTION_DISPATCH_APR_18_2008_0720AM
+
+#include <boost/spirit/home/support/detail/values.hpp>
+
+namespace boost { namespace spirit { namespace detail
+{
+    template <typename F, typename Attribute, typename Context>
+    bool action_dispatch(F const& f, Attribute& attr, Context& context)
+    {
+        bool pass = true;
+        f(pass_value<Attribute>::call(attr), context, pass);
+        return pass;
+    }
+
+    template <typename RT, typename A0, typename A1, typename A2
+      , typename Attribute, typename Context>
+    bool action_dispatch(RT(*f)(A0&, A1&, A2&)
+      , Attribute& attr, Context& context)
+    {
+        f(attr, context, pass);
+    }
+
+    template <typename RT, typename A0, typename A1, typename A2
+      , typename Attribute, typename Context>
+    bool action_dispatch(RT(&f)(A0&, A1&, A2&)
+      , Attribute& attr, Context& context)
+    {
+        f(attr, context, pass);
+    }
+}}}
+
+#endif