Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2001-10-04 14:22:56


From: "Levente Farkas" <lfarkas_at_[hidden]>
> Peter Dimov wrote:
> > I get a reference to reference error within the iterator adaptors
library,
> > so any changes to functional.hpp and/or compose.hpp are unlikely to fix
> > that.
>
> that's the problem! so we need a common desing strategy. is argument_type
> realy the argumnet's type (without any more qualifier) and result_type
> the result type or not! the basic of the whole problem is in the C++
> standard which defines functors to return with value instead of reference.
> so I don't know the solution:-(((

Ah, I see. make_projection_iterator assumes that value_type ==
F::result_type.

Well, boost::bind doesn't attempt to lie with its result_types. This is not
a good idea in general, since when you see result_type == int, you have
absolutely no idea how to handle it; you can't return f(...) by reference,
since f() may really return by value.

From a cursory glance it appears that if this is fixed,
make_projection_iterator will work for const iterators as well, rendering
make_const_projection_iterator obsolete.

The problem, of course, is how to get the value_type on MSVC.

--
Peter Dimov
Multi Media Ltd.

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