Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r66934 - in trunk/boost/spirit/home/support/utree: . detail
From: hartmut.kaiser_at_[hidden]
Date: 2010-11-30 17:54:58


Author: hkaiser
Date: 2010-11-30 17:54:56 EST (Tue, 30 Nov 2010)
New Revision: 66934
URL: http://svn.boost.org/trac/boost/changeset/66934

Log:
Spirit: more fixes to utree
Text files modified:
   trunk/boost/spirit/home/support/utree/detail/utree_detail2.hpp | 6 +++++-
   trunk/boost/spirit/home/support/utree/utree_traits.hpp | 23 +++++++++++++++++++++++
   2 files changed, 28 insertions(+), 1 deletions(-)

Modified: trunk/boost/spirit/home/support/utree/detail/utree_detail2.hpp
==============================================================================
--- trunk/boost/spirit/home/support/utree/detail/utree_detail2.hpp (original)
+++ trunk/boost/spirit/home/support/utree/detail/utree_detail2.hpp 2010-11-30 17:54:56 EST (Tue, 30 Nov 2010)
@@ -1245,7 +1245,11 @@
         }
         else if (get_type() != type::list_type)
         {
- boost::throw_exception(bad_type_exception());
+ // convert this instance into a list by transforming the current
+ // content into the first node in a list
+ utree ut;
+ ut.push_back(*this);
+ ut.swap(*this);
         }
     }
 

Modified: trunk/boost/spirit/home/support/utree/utree_traits.hpp
==============================================================================
--- trunk/boost/spirit/home/support/utree/utree_traits.hpp (original)
+++ trunk/boost/spirit/home/support/utree/utree_traits.hpp 2010-11-30 17:54:56 EST (Tue, 30 Nov 2010)
@@ -76,6 +76,29 @@
     };
 
     ///////////////////////////////////////////////////////////////////////////
+ // this specialization is required to disambiguate the specialization
+ template <>
+ struct assign_to_attribute_from_value<utree, utree>
+ {
+ static void
+ call(utree const& val, utree& attr)
+ {
+ attr = val;
+ }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////
+ // debug support for utree
+ template <typename Out>
+ struct print_attribute_debug<Out, utree>
+ {
+ static void call(Out& out, utree const& val)
+ {
+ out << val;
+ }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////
     // the specialization below tells Spirit to handle utree as if it
     // where a 'real' variant (in the context of karma)
     template <>


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