Boost logo

Boost :

From: Mark Rodgers (mark.rodgers_at_[hidden])
Date: 2001-03-29 14:23:11


From: "Kresimir Fresl" <fresl_at_[hidden]>
> On Thursday 29 March 2001 18:13, Jeremy Siek wrote:
>
> > What a bummer, it looks like we can't legally use std::binder1st with
> > transform_iterator. The requirement for default constructor is not
> > accidental, it is absolutely required because the function object needs
to
> > be contained in the iterator, and the standard requires iterators to
have
> > default constructors. We'll have to use a replacement for binder1st in
the
> > example.
>
> > Perhaps the lack of default constructor in std::binder1st qualifies as
a
> > DR?
>
> Is it possible (as a `first aid' ;O) to add default constructors to
> boost::binder1st and other related function object adapters in
> <boost/functional.hpp> ?

That would mean that the bound value would have to be default
constructible, which currently it does not have to be. I'd be reluctant
to impose additional constraints on what can be bound.

If I were to add a default constructor that default initialised the
function and the value, presumably that would not get instantiated
if it wasn't used, so would be all right???? 14.7.1 para 1 seems to
indicate that would be the case.

However I don't quite understand why the function object "needs" to be
contained in the iterator, and how a default constructed binder could
possibly be useful.

Mark


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