Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r79763 - in trunk/boost/xpressive: . detail/static
From: eric_at_[hidden]
Date: 2012-07-26 21:37:09


Author: eric_niebler
Date: 2012-07-26 21:37:08 EDT (Thu, 26 Jul 2012)
New Revision: 79763
URL: http://svn.boost.org/trac/boost/changeset/79763

Log:
only string iterators point to contiguous data
Text files modified:
   trunk/boost/xpressive/detail/static/type_traits.hpp | 37 +++++++++++++++++++++++++++++++++++++
   trunk/boost/xpressive/regex_actions.hpp | 4 +++-
   2 files changed, 40 insertions(+), 1 deletions(-)

Modified: trunk/boost/xpressive/detail/static/type_traits.hpp
==============================================================================
--- trunk/boost/xpressive/detail/static/type_traits.hpp (original)
+++ trunk/boost/xpressive/detail/static/type_traits.hpp 2012-07-26 21:37:08 EDT (Thu, 26 Jul 2012)
@@ -13,6 +13,8 @@
 # pragma once
 #endif
 
+#include <string>
+#include <boost/config.hpp>
 #include <boost/mpl/bool.hpp>
 #include <boost/iterator/iterator_traits.hpp>
 #include <boost/type_traits/is_convertible.hpp>
@@ -55,6 +57,41 @@
 {
 };
 
+//////////////////////////////////////////////////////////////////////////
+// is_string_iterator
+//
+template<typename Iter>
+struct is_string_iterator
+ : mpl::false_
+{
+};
+
+template<>
+struct is_string_iterator<std::string::iterator>
+ : mpl::true_
+{
+};
+
+template<>
+struct is_string_iterator<std::string::const_iterator>
+ : mpl::true_
+{
+};
+
+#ifndef BOOST_NO_STD_WSTRING
+template<>
+struct is_string_iterator<std::wstring::iterator>
+ : mpl::true_
+{
+};
+
+template<>
+struct is_string_iterator<std::wstring::const_iterator>
+ : mpl::true_
+{
+};
+#endif
+
 ///////////////////////////////////////////////////////////////////////////////
 // is_char
 //

Modified: trunk/boost/xpressive/regex_actions.hpp
==============================================================================
--- trunk/boost/xpressive/regex_actions.hpp (original)
+++ trunk/boost/xpressive/regex_actions.hpp 2012-07-26 21:37:08 EDT (Thu, 26 Jul 2012)
@@ -572,12 +572,14 @@
                   : boost::lexical_cast<T>("");
             }
 
+ #ifndef BOOST_XPRESSIVE_NO_WREGEX
             T operator()(wcsub_match const &val) const
             {
                 return val.matched
                   ? boost::lexical_cast<T>(boost::make_iterator_range(val.first, val.second))
                   : boost::lexical_cast<T>("");
             }
+ #endif
 
             template<typename BidiIter>
             T operator()(sub_match<BidiIter> const &val) const
@@ -590,7 +592,7 @@
                   , CAN_ONLY_CONVERT_FROM_CHARACTER_SEQUENCES
                   , (char_type)
                 );
- return this->impl(val, xpressive::detail::is_random<BidiIter>());
+ return this->impl(val, xpressive::detail::is_string_iterator<BidiIter>());
             }
 
         private:


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