Boost logo

Boost :

From: Neal Becker (ndbecker2_at_[hidden])
Date: 2007-11-19 17:12:24


Eric Niebler wrote:

...
>
> There are some surprisingly thorny issues wrt range-based algorithms,
> which I list in the appendix of the range_ex docs. In particular, does
> an "output range" make sense? Range_ex uses output iterators instead of
> output ranges. At the time, I thought that was unsatisfactory. Less so
> now, but it's still an open issue.
>
>

What's the issue with returning a range? How else can they be chained?

What is your opinion of this style of algorithm?

template<typename out_t, typename in_t>
inline out_t algorithm (in_t const& in) {
  out_t out (boost::size (in)); assuming output size same as input

  do_something_with(in)

  return out;
}

This assumes return value optimization, which I've verified on recent gcc.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk