$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r57904 - trunk/boost/spirit/home/support
From: hartmut.kaiser_at_[hidden]
Date: 2009-11-24 15:56:31
Author: hkaiser
Date: 2009-11-24 15:56:31 EST (Tue, 24 Nov 2009)
New Revision: 57904
URL: http://svn.boost.org/trac/boost/changeset/57904
Log:
Spirit: added specializations for the push_back CP for optional attribute values
Text files modified: 
   trunk/boost/spirit/home/support/container.hpp |    24 ++++++++++++++++++++++++                
   1 files changed, 24 insertions(+), 0 deletions(-)
Modified: trunk/boost/spirit/home/support/container.hpp
==============================================================================
--- trunk/boost/spirit/home/support/container.hpp	(original)
+++ trunk/boost/spirit/home/support/container.hpp	2009-11-24 15:56:31 EST (Tue, 24 Nov 2009)
@@ -273,6 +273,30 @@
         }
     };
 
+    template <typename Container, typename T>
+    struct push_back_container<Container, optional<T> >
+    {
+        static void call(Container& c, optional<T> const& val)
+        {
+            if (val)
+                push_back(c, boost::get<T>(val));
+        }
+    };
+
+    template <typename Container, typename T>
+    struct push_back_container<optional<Container>, optional<T> >
+    {
+        static void call(optional<Container>& c, optional<T> const& val)
+        {
+            if (val)
+            {
+                if (!c)
+                    c = Container();
+                push_back(boost::get<Container>(c), boost::get<T>(val));
+            }
+        }
+    };
+
     namespace detail
     {
         template <typename T>