Boost logo

Boost :

Subject: Re: [boost] [Bind] Interoperability of bind/mem_fn with transform_iterator
From: Jeffrey Lee Hellrung, Jr. (jhellrung_at_[hidden])
Date: 2010-05-04 18:55:06


On 5/4/2010 3:49 PM, Daniel Walker wrote:
> On Tue, May 4, 2010 at 1:49 PM, Peter Dimov<pdimov_at_[hidden]> wrote:
>> Samuel Debionne:
>>>
>>> Anyway, in my opinion, using bind/mem_fn/lambda with transform_iterator
>>> is a common use case. That would be great to have an option to add a
>>> default constructor in those libs... or is it to risky ?
>>
>> The proper fix would be to make transform_iterator not require a
>> default-constructible function object, by using boost::optional or an
>> equivalent.
>
> That's a great idea! I took a look at it, and the required changes
> seem to be minor. I made a ticket and attached a patch.
> https://svn.boost.org/trac/boost/ticket/4189
> I ran Boost.Iterator regression tests with gcc 4.2 and it passed without error.
>
> Daniel Walker

Maybe you should only conditionally wrap in a boost::optional, e.g., if
has_trivial_constructor<F> is false (I don't think there's a standard
is_default_constructible trait, right?).

- Jeff


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