Boost logo

Boost :

From: Daryle Walker (darylew_at_[hidden])
Date: 2005-09-22 13:48:43


On 9/19/05 4:58 AM, "Martin Bonner" <martin.bonner_at_[hidden]> wrote:

> ----Original Message----
> From: Daryle Walker [mailto:darylew_at_[hidden]]
> Sent: 18 September 2005 20:54
> To: Boost mailing list
> Subject: Re: [boost] [Review] xpressive
>
>> Making something like:
>>
>> std::copy( pieces.begin(), pieces.end(), destination );
>>
>> completely useless isn't unfriendly?
>
>> You'll have to use a (mutable) object to store
>> "pieces.begin()" so you can increment it before the copy
>
> ??? Why can't you use:
> std::copy( ++pieces.begin(), pieces.end(), destination );

1. "pieces.begin()" is a temporary, so you can't use "++" directly. You
could use something like "boost::next", though.
2. Any such increment is illegal if "pieces" is empty.
3. It isn't template friendly if you pass in the container instead of an
iterator pair (since element-0 has a different nature than the other
elements).

-- 
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT hotmail DOT com

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