Subject: Re: [Boost-bugs] [Boost C++ Libraries] #2578: Add double-bounded version of outputting algorithms
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-05-23 21:19:06
#2578: Add double-bounded version of outputting algorithms
-------------------------------+--------------------------------------------
Reporter: dlwalker | Owner: neilgroves
Type: Feature Requests | Status: new
Milestone: Boost 1.38.0 | Component: range
Version: Boost 1.37.0 | Severity: Not Applicable
Resolution: | Keywords: algorithm iterator bound
-------------------------------+--------------------------------------------
Comment (by neilgroves):
Currently I have provided better alternatives than the two iterator
versions of algorithms. I have commented in the Boost.Range documentation
that it is better to use the functions under the boost/range/algorithm_ext
folder to achieve the same job.
Your copy example can be achived in a superior manner by using
boost::overwrite(source, target); However a superior idiom is frequently
to use my push_back algorithm. For example:
#include <boost/range/algorithm_ext/push_back.hpp>
#include <boost/range/adaptor/reversed.hpp>
#include <vector>
int main()
{
// ... :TODO: populate a source vector snipped for emphasis of the
relevant concept
std::vector<int> v;
boost::push_back(v, source | boost::adaptors::reversed);
return 0;
}
This will populate the vector v in an efficient manner with the range of
information in 'source' in reverse order. It is my experience that I very
rarely miss the target iterator versions of algorithms. The main occasion
I still use them is for output stream iterators, which is typically a safe
idiom.
There has been discussion on the ML in the past about the formalisation of
some 'Sink' Concepts, but so far I have been surprised by the satisfactory
nature of the current functions in algorithm_ext. I welcome peoples
experiences, and particularly their use cases for sinks, output iterators
or other target concepts.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/2578#comment:3> 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:06 UTC