[range] transform surprise

I'm surprised that boost::range::transform args are template< class SinglePassRange1, class OutputIterator, class UnaryOperation
OutputIterator transform(const SinglePassRange1& rng, OutputIterator out, UnaryOperation fun); I would have expected: template< class SinglePassRange1, class SinglePassRange2, class UnaryOperation
OutputIterator transform(const SinglePassRange1& rng, SinglePassRange2& out, UnaryOperation fun); Why the asymmetry?

On 05/03/2011 15:27, Neal Becker wrote:
I'm surprised that boost::range::transform args are
template< class SinglePassRange1, class OutputIterator, class UnaryOperation
OutputIterator transform(const SinglePassRange1& rng, OutputIterator out, UnaryOperation fun);
I would have expected:
template< class SinglePassRange1, class SinglePassRange2, class UnaryOperation
OutputIterator transform(const SinglePassRange1& rng, SinglePassRange2& out, UnaryOperation fun);
Why the asymmetry?
An output range would imply that the algorithm does bounds checking on its target.

On 3/5/2011 3:57 PM, Mathias Gaunard wrote:
On 05/03/2011 15:27, Neal Becker wrote:
I would have expected:
template< class SinglePassRange1, class SinglePassRange2, class UnaryOperation
OutputIterator transform(const SinglePassRange1& rng, SinglePassRange2& out, UnaryOperation fun);
Why the asymmetry?
An output range would imply that the algorithm does bounds checking on its target.
Also notice that the preferred way is simply to use boost::push_back (etc) and boost::adaptors::transformed. -Thorsten
participants (3)
-
Mathias Gaunard
-
Neal Becker
-
Thorsten Ottosen