Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r59354 - in trunk/boost/spirit/home: karma/detail support
From: hartmut.kaiser_at_[hidden]
Date: 2010-01-29 21:13:48


Author: hkaiser
Date: 2010-01-29 21:13:47 EST (Fri, 29 Jan 2010)
New Revision: 59354
URL: http://svn.boost.org/trac/boost/changeset/59354

Log:
Spirit: proper use of customization points in string_generate
Text files modified:
   trunk/boost/spirit/home/karma/detail/string_generate.hpp | 6 +++---
   trunk/boost/spirit/home/support/container.hpp | 8 ++++++++
   2 files changed, 11 insertions(+), 3 deletions(-)

Modified: trunk/boost/spirit/home/karma/detail/string_generate.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/detail/string_generate.hpp (original)
+++ trunk/boost/spirit/home/karma/detail/string_generate.hpp 2010-01-29 21:13:47 EST (Fri, 29 Jan 2010)
@@ -56,9 +56,9 @@
     inline bool string_generate(OutputIterator& sink
       , Container const& c, Filter filter)
     {
- typename range_const_iterator<Container>::type end = boost::end(c);
- for (typename range_const_iterator<Container>::type it = boost::begin(c);
- it != end; ++it)
+ typedef typename traits::container_iterator<Container>::type iterator;
+ iterator end = boost::end(c);
+ for (iterator it = boost::begin(c); it != end; ++it)
         {
             *sink = filter(*it);
             ++sink;

Modified: trunk/boost/spirit/home/support/container.hpp
==============================================================================
--- trunk/boost/spirit/home/support/container.hpp (original)
+++ trunk/boost/spirit/home/support/container.hpp 2010-01-29 21:13:47 EST (Fri, 29 Jan 2010)
@@ -22,6 +22,7 @@
 #include <boost/variant.hpp>
 #include <boost/preprocessor/cat.hpp>
 #include <boost/preprocessor/repeat.hpp>
+#include <boost/range/iterator_range.hpp>
 
 namespace boost { namespace spirit { namespace traits
 {
@@ -163,6 +164,13 @@
         typedef typename Container::const_iterator type;
     };
 
+ template <typename Iterator>
+ struct container_iterator<iterator_range<Iterator> >
+ {
+ typedef typename range_const_iterator<
+ iterator_range<Iterator> >::type type;
+ };
+
     template <>
     struct container_iterator<unused_type>
     {


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