Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r56219 - trunk/boost/spirit/home/karma/operator
From: hartmut.kaiser_at_[hidden]
Date: 2009-09-15 13:07:33


Author: hkaiser
Date: 2009-09-15 13:07:33 EDT (Tue, 15 Sep 2009)
New Revision: 56219
URL: http://svn.boost.org/trac/boost/changeset/56219

Log:
Spirit: unified handling of optional values
Text files modified:
   trunk/boost/spirit/home/karma/operator/optional.hpp | 49 +--------------------------------------
   1 files changed, 2 insertions(+), 47 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 2009-09-15 13:07:33 EDT (Tue, 15 Sep 2009)
@@ -35,51 +35,6 @@
 ///////////////////////////////////////////////////////////////////////////////
 namespace boost { namespace spirit { namespace karma
 {
- namespace detail
- {
- ///////////////////////////////////////////////////////////////////////
- template <typename Attribute>
- inline bool
- optional_is_valid(boost::optional<Attribute> const& opt)
- {
- return opt;
- }
-
- template <typename Attribute>
- inline bool
- optional_is_valid(Attribute const& opt)
- {
- return true;
- }
-
- inline bool
- optional_is_valid(unused_type)
- {
- return true;
- }
-
- ///////////////////////////////////////////////////////////////////////
- template <typename Attribute>
- inline Attribute const&
- optional_get(boost::optional<Attribute> const& opt)
- {
- return get(opt);
- }
-
- template <typename Attribute>
- inline Attribute const&
- optional_get(Attribute const& opt)
- {
- return opt;
- }
-
- inline unused_type
- optional_get(unused_type)
- {
- return unused;
- }
- }
-
     ///////////////////////////////////////////////////////////////////////////
     template <typename Subject>
     struct optional : unary_generator<optional<Subject> >
@@ -106,8 +61,8 @@
         bool generate(OutputIterator& sink, Context& ctx
           , Delimiter const& d, Attribute const& attr) const
         {
- if (detail::optional_is_valid(attr))
- subject.generate(sink, ctx, d, detail::optional_get(attr));
+ if (traits::has_optional_value(attr))
+ subject.generate(sink, ctx, d, traits::optional_value(attr));
             return sink_is_good(sink);
         }
 


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