Subject: Re: [Boost-bugs] [Boost C++ Libraries] #9518: string_ref::rfind return value offset
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-08-13 08:37:07
#9518: string_ref::rfind return value offset
-------------------------------------+---------------------------
Reporter: Peter A. Bigot <pab@â¦> | Owner: no-maintainer
Type: Bugs | Status: new
Milestone: To Be Determined | Component: utility
Version: Boost 1.55.0 | Severity: Problem
Resolution: | Keywords:
-------------------------------------+---------------------------
Comment (by bimaster@â¦):
proposed fix (not fixed yet in 1.59.beta):
{{{#!C++
size_type rfind(basic_string_ref x, size_t pos = npos) const {
const_reverse_iterator s = this->crbegin();
const_reverse_iterator e = this->crend();
if(pos < size()) s += pos;
const_reverse_iterator iter = std::search(s, e, x.crbegin(),
x.crend(), traits::eq);
// the only case where substring is searched, reverse_distance not
applicable
return iter == e ? npos : len_ - std::distance(this->crbegin(), iter)
- x.size();
}
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/9518#comment:1> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:18 UTC