Boost logo

Boost :

From: Douglas Gregor (gregod_at_[hidden])
Date: 2001-11-15 11:50:45

On Thursday 15 November 2001 10:08 am, you wrote:
> Before you go ahead and implement this, I suggest we consider adding a
> separate 'fref' to ref.hpp.
> It would be just like 'ref' except it would define, instead of 'operator
> T&', a bunch of forwarding operator()s.
> The reasons for this are:
> * fref() would be useful for dealing with standard algorithms that tend to
> make copies of the function object and generally don't like stateful
> function objects.
> * ref(x), in a broader, lambda library context, is a function object that
> (regardless of the arguments passed to it) returns a reference to x, like
> in
> ref(x) += _1;
> So there is a conflict between ref(f)(x) meaning f(x) or just f.

Because I don't agree with the broader context of ref(x) here, I also
disagree with the need to add fref(x). ref(x) can be extended to support the
capabilities one would want for fref(x), and would present a more consistent
interface to the user.


Boost list run by bdawes at, gregod at, cpdaniel at, john at