|
Boost : |
From: Douglas Gregor (gregod_at_[hidden])
Date: 2003-02-19 11:30:53
On Friday 14 February 2003 02:56 pm, Peter Dimov wrote:
> Douglas Gregor wrote:
> > std::transform(c.begin(), c.end(), out, boost::ref<float>(f));
>
> I'm not sure whether that last part is a good idea.
>
> The ref "vision" has been that in a perfect world,
>
> ref(f)(x, y);
>
> is exactly the same as
>
> F & rf = f;
> rf(x, y);
>
> and the best way to accomplish that is a core change that enables all
> conversion operators to be considered in function calls (currently only
> conversion operators to pointers to functions are considered.)
Agreed.
> With this in mind, the implementation of ref(f) that relies on the typedefs
> to approximate the above is fine (although it might be overkill to consider
> anything beyond result_type and perhaps sig) but the ref<R> syntax doesn't
> rhyme. We need to keep in mind that ref<Base>(derived) and ref<int
> const>(5) are valid today.
I can't think of any reason to write either of these last expressions, but I
don't mind removing the extra syntax. Actually, this has the secondary
benefit of eliminating the extra template parameter I needed to add to
reference_wrapper.
Doug
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk