Re: [Boost-bugs] [Boost C++ Libraries] #6683: find family of functions needs const Range1T& Input overloads

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #6683: find family of functions needs const Range1T& Input overloads
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-03-13 17:51:15


#6683: find family of functions needs const Range1T& Input overloads
--------------------------------+-------------------------------------------
  Reporter: sairony@… | Owner: marshall
      Type: Feature Requests | Status: assigned
 Milestone: To Be Determined | Component: algorithm
   Version: Boost 1.48.0 | Severity: Problem
Resolution: | Keywords:
--------------------------------+-------------------------------------------

Comment (by anonymous):

 Sorry. The signature for lets say find_first is:

 template<typename Range1T, typename Range2T>
 inline iterator_range< BOOST_STRING_TYPENAME range_iterator<Range1T>::type
>
 find_first( Range1T& Input, const Range2T& Search )

 As Input isn't const it's not possible to pass rvalues. Now, what I
 speculate is the reason for why it isn't const ( because it would be
 natural to assume that merely searching would not need to alter the
 content ), is because iterator_range<> in this case which is returned from
 the function gives the caller the opportunity to alter Input indirectly
 through the iterator_range. So, what I propose is something which would
 have the following signature instead added as an overload:

 template<typename Range1T, typename Range2T>
 inline const_iterator_range< BOOST_STRING_TYPENAME
 const_range_iterator<Range1T>::type >
 find_first( const Range1T& Input, const Range2T& Search )

 const_iterator_range in this case would serve the same role that
 const_iterator does compared to iterator in std.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/6683#comment:2>
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:09 UTC