Boost logo

Boost :

Subject: Re: [boost] Proposed interface change to boost::algorithm::copy_while
From: Marshall Clow (mclow.lists_at_[hidden])
Date: 2013-02-26 16:00:34

On Feb 26, 2013, at 12:50 PM, Jonathan Wakely <jwakely.boost_at_[hidden]> wrote:

> On 26 February 2013 20:36, Marshall Clow wrote:
>> I just realized another reason not to like this.
>> If your prototype looks like this:
>> template<typename InputIterator, typename OutputIterator, typename Predicate>
>> OutputIterator copy_while ( InputIterator &first, InputIterator last, OutputIterator result, Predicate );
>> you can't call it like this:
>> copy_while ( v.begin (), v.end (), out, pred );
> But you could add the by-reference form as an overload, existing code
> passing an rvalue gets the old behaviour and doesn't get the extra
> information, which is OK because they never got it before now anyway.

Yes, but existing callers who were passing an lvalue get a silent change in behavior; their variable changes out from under them.

-- Marshall

Marshall Clow Idio Software <mailto:mclow.lists_at_[hidden]>

A.D. 1517: Martin Luther nails his 95 Theses to the church door and is promptly moderated down to (-1, Flamebait).
        -- Yu Suzuki

Boost list run by bdawes at, gregod at, cpdaniel at, john at