Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r85727 - in branches/release: boost boost/regex boost/regex/v4 libs/regex
From: john_at_[hidden]
Date: 2013-09-17 13:42:01


Author: johnmaddock
Date: 2013-09-17 13:42:00 EDT (Tue, 17 Sep 2013)
New Revision: 85727
URL: http://svn.boost.org/trac/boost/changeset/85727

Log:
Merge minor fixes from Trunk.

Properties modified:
   branches/release/boost/cregex.hpp (props changed)
   branches/release/boost/regex/ (props changed)
   branches/release/boost/regex.hpp (props changed)
   branches/release/libs/regex/ (props changed)
Text files modified:
   branches/release/boost/regex/v4/perl_matcher_non_recursive.hpp | 24 +++++++++++++++++++++---
   branches/release/boost/regex/v4/perl_matcher_recursive.hpp | 16 ++++++++++++++--
   2 files changed, 35 insertions(+), 5 deletions(-)

Modified: branches/release/boost/regex/v4/perl_matcher_non_recursive.hpp
==============================================================================
--- branches/release/boost/regex/v4/perl_matcher_non_recursive.hpp Tue Sep 17 13:37:46 2013 (r85726)
+++ branches/release/boost/regex/v4/perl_matcher_non_recursive.hpp 2013-09-17 13:42:00 EDT (Tue, 17 Sep 2013) (r85727)
@@ -703,7 +703,13 @@
    if(::boost::is_random_access_iterator<BidiIterator>::value)
    {
       BidiIterator end = position;
- std::advance(end, (std::min)((std::size_t)::boost::re_detail::distance(position, last), desired));
+ // Move end forward by "desired", preferably without using distance or advance if we can
+ // as these can be slow for some iterator types.
+ std::size_t len = (desired == (std::numeric_limits<std::size_t>::max)()) ? 0u : ::boost::re_detail::distance(position, last);
+ if(desired >= len)
+ end = last;
+ else
+ std::advance(end, desired);
       BidiIterator origin(position);
       while((position != end) && (traits_inst.translate(*position, icase) == what))
       {
@@ -771,7 +777,13 @@
    if(::boost::is_random_access_iterator<BidiIterator>::value)
    {
       BidiIterator end = position;
- std::advance(end, (std::min)((std::size_t)::boost::re_detail::distance(position, last), desired));
+ // Move end forward by "desired", preferably without using distance or advance if we can
+ // as these can be slow for some iterator types.
+ std::size_t len = (desired == (std::numeric_limits<std::size_t>::max)()) ? 0u : ::boost::re_detail::distance(position, last);
+ if(desired >= len)
+ end = last;
+ else
+ std::advance(end, desired);
       BidiIterator origin(position);
       while((position != end) && map[static_cast<unsigned char>(traits_inst.translate(*position, icase))])
       {
@@ -840,7 +852,13 @@
    if(::boost::is_random_access_iterator<BidiIterator>::value)
    {
       BidiIterator end = position;
- std::advance(end, (std::min)((std::size_t)::boost::re_detail::distance(position, last), desired));
+ // Move end forward by "desired", preferably without using distance or advance if we can
+ // as these can be slow for some iterator types.
+ std::size_t len = (desired == (std::numeric_limits<std::size_t>::max)()) ? 0u : ::boost::re_detail::distance(position, last);
+ if(desired >= len)
+ end = last;
+ else
+ std::advance(end, desired);
       BidiIterator origin(position);
       while((position != end) && (position != re_is_set_member(position, last, set, re.get_data(), icase)))
       {

Modified: branches/release/boost/regex/v4/perl_matcher_recursive.hpp
==============================================================================
--- branches/release/boost/regex/v4/perl_matcher_recursive.hpp Tue Sep 17 13:37:46 2013 (r85726)
+++ branches/release/boost/regex/v4/perl_matcher_recursive.hpp 2013-09-17 13:42:00 EDT (Tue, 17 Sep 2013) (r85727)
@@ -641,7 +641,13 @@
    if(::boost::is_random_access_iterator<BidiIterator>::value)
    {
       BidiIterator end = position;
- std::advance(end, (std::min)((std::size_t)::boost::re_detail::distance(position, last), desired));
+ // Move end forward by "desired", preferably without using distance or advance if we can
+ // as these can be slow for some iterator types.
+ std::size_t len = (desired == (std::numeric_limits<std::size_t>::max)()) ? 0u : ::boost::re_detail::distance(position, last);
+ if(desired >= len)
+ end = last;
+ else
+ std::advance(end, desired);
       BidiIterator origin(position);
       while((position != end) && map[static_cast<unsigned char>(traits_inst.translate(*position, icase))])
       {
@@ -731,7 +737,13 @@
    if(::boost::is_random_access_iterator<BidiIterator>::value)
    {
       BidiIterator end = position;
- std::advance(end, (std::min)((std::size_t)::boost::re_detail::distance(position, last), desired));
+ // Move end forward by "desired", preferably without using distance or advance if we can
+ // as these can be slow for some iterator types.
+ std::size_t len = (desired == (std::numeric_limits<std::size_t>::max)()) ? 0u : ::boost::re_detail::distance(position, last);
+ if(desired >= len)
+ end = last;
+ else
+ std::advance(end, desired);
       BidiIterator origin(position);
       while((position != end) && (position != re_is_set_member(position, last, set, re.get_data(), icase)))
       {


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