Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r58971 - in trunk/boost/spirit/home: karma/stream/detail qi/stream/detail
From: hartmut.kaiser_at_[hidden]
Date: 2010-01-13 08:23:27


Author: hkaiser
Date: 2010-01-13 08:23:25 EST (Wed, 13 Jan 2010)
New Revision: 58971
URL: http://svn.boost.org/trac/boost/changeset/58971

Log:
Spirit: reformulating static assertion
Text files modified:
   trunk/boost/spirit/home/karma/stream/detail/format_manip.hpp | 12 ++++++------
   trunk/boost/spirit/home/qi/stream/detail/match_manip.hpp | 12 ++++++------
   2 files changed, 12 insertions(+), 12 deletions(-)

Modified: trunk/boost/spirit/home/karma/stream/detail/format_manip.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/stream/detail/format_manip.hpp (original)
+++ trunk/boost/spirit/home/karma/stream/detail/format_manip.hpp 2010-01-13 08:23:25 EST (Wed, 13 Jan 2010)
@@ -25,6 +25,12 @@
       , typename Delimiter = unused_type, typename Attribute = unused_type>
     struct format_manip
     {
+ // This assertion makes sure we don't hit the only code path which is
+ // not implemented (because it isn't needed), where both, the
+ // expression and the attribute need to be held as a copy.
+ BOOST_SPIRIT_ASSERT_MSG(!CopyExpr::value || !CopyAttr::value
+ , error_invalid_should_not_happen, ());
+
         format_manip(Expr const& xpr, Delimiter const& d, Attribute const& a)
           : expr(xpr), delim(d), pre(delimit_flag::dont_predelimit), attr(a) {}
 
@@ -82,12 +88,6 @@
         format_manip& operator= (format_manip const&);
     };
 
- template <typename Expr, typename Delimiter, typename Attribute>
- struct format_manip<Expr, mpl::true_, mpl::true_, Delimiter, Attribute>
- {
- BOOST_SPIRIT_ASSERT_MSG(false, error_invalid_should_not_happen, ());
- };
-
     ///////////////////////////////////////////////////////////////////////////
     template <typename Expr, typename Enable = void>
     struct format

Modified: trunk/boost/spirit/home/qi/stream/detail/match_manip.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/stream/detail/match_manip.hpp (original)
+++ trunk/boost/spirit/home/qi/stream/detail/match_manip.hpp 2010-01-13 08:23:25 EST (Wed, 13 Jan 2010)
@@ -28,6 +28,12 @@
       , typename Skipper = unused_type, typename Attribute = unused_type const>
     struct match_manip
     {
+ // This assertion makes sure we don't hit the only code path which is
+ // not implemented (because it isn't needed), where both, the
+ // expression and the attribute need to be held as a copy.
+ BOOST_SPIRIT_ASSERT_MSG(!CopyExpr::value || !CopyAttr::value
+ , error_invalid_should_not_happen, ());
+
         match_manip(Expr const& xpr, Skipper const& s, Attribute& a)
           : expr(xpr), skipper(s), attr(a), post_skip(skip_flag::postskip) {}
 
@@ -85,12 +91,6 @@
         match_manip& operator= (match_manip const&);
     };
 
- template <typename Expr, typename Skipper, typename Attribute>
- struct match_manip<Expr, mpl::true_, mpl::true_, Skipper, Attribute>
- {
- BOOST_SPIRIT_ASSERT_MSG(false, error_invalid_should_not_happen, ());
- };
-
     ///////////////////////////////////////////////////////////////////////////
     template <typename Expr, typename Enable = void>
     struct match


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