$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r50080 - trunk/boost/spirit/home/karma/operator
From: hartmut.kaiser_at_[hidden]
Date: 2008-12-02 18:27:11
Author: hkaiser
Date: 2008-12-02 18:27:11 EST (Tue, 02 Dec 2008)
New Revision: 50080
URL: http://svn.boost.org/trac/boost/changeset/50080
Log:
Spirit.Karma: Fixed optional operator
Text files modified: 
   trunk/boost/spirit/home/karma/operator/optional.hpp |    74 ++++++++++++++++++--------------------- 
   1 files changed, 34 insertions(+), 40 deletions(-)
Modified: trunk/boost/spirit/home/karma/operator/optional.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/operator/optional.hpp	(original)
+++ trunk/boost/spirit/home/karma/operator/optional.hpp	2008-12-02 18:27:11 EST (Tue, 02 Dec 2008)
@@ -22,44 +22,44 @@
     namespace detail
     {
         template <typename Parameter>
-        struct optional_attribute
+        inline bool
+        optional_is_valid(boost::optional<Parameter> const& opt)
         {
-            static inline bool
-            is_valid(boost::optional<Parameter> const& opt)
-            {
-                return opt;
-            }
+            return opt;
+        }
 
-            static inline bool
-            is_valid(Parameter const&)
-            {
-                return true;
-            }
+        template <typename Parameter>
+        inline bool
+        optional_is_valid(Parameter const& opt)
+        {
+            return true;
+        }
 
-            static inline bool
-            is_valid(unused_type)
-            {
-                return true;
-            }
+        inline bool
+        optional_is_valid(unused_type)
+        {
+            return true;
+        }
 
-            static inline Parameter const&
-            get(boost::optional<Parameter> const& opt)
-            {
-                return boost::get(opt);
-            }
+        template <typename Parameter>
+        inline Parameter const&
+        optional_get(boost::optional<Parameter> const& opt)
+        {
+            return get(opt);
+        }
 
-            static inline Parameter const&
-            get(Parameter const& p)
-            {
-                return p;
-            }
+        template <typename Parameter>
+        inline Parameter const&
+        optional_get(Parameter const& opt)
+        {
+            return opt;
+        }
 
-            static inline unused_type
-            get(unused_type)
-            {
-                return unused;
-            }
-        };
+        inline unused_type
+        optional_get(unused_type)
+        {
+            return unused;
+        }
     }
 
     struct optional
@@ -86,16 +86,10 @@
                 result_of::subject<Component>::type::director
             director;
 
-            typedef typename traits::attribute_of<
-                karma::domain, typename result_of::subject<Component>::type, 
-                Context, unused_type
-            >::type attribute_type;
-
-            typedef detail::optional_attribute<attribute_type> optional_type;
-            if (optional_type::is_valid(param))
+            if (detail::optional_is_valid(param))
             {
                 director::generate(subject(component), sink, ctx, d,
-                    optional_type::get(param));
+                    detail::optional_get(param));
             }
             return true;
         }