Boost logo

Boost :

From: Jeremy Siek (jsiek_at_[hidden])
Date: 2001-10-05 17:01:48

On Thu, 4 Oct 2001, David Abrahams wrote:
david.> Is the result_type of an AdaptableUnaryFunction returning a reference
david.> supposed to be a reference type? I would think so. Our documentation seems
david.> to suggest making the result_type a value instead. Jeremy?

The projection_iterator assumes that the result_type is not a reference.
Hmm, now to decide whether this was a good assumption or not...
I'm looking at the definition of
and some models of it like

template <class T>
struct identity {
  typedef T result_type;
  const T& operator()(const T& x) const { return x; }

the way identity is defined suggests that result_type is expected
to not be a reference...
Also, looking at plus, minus, etc. same thing.

Then looking at ptr_fun... I wonder if the designer anticipated
it being used with function that return a reference type. The example
there, fabs returns by value. I think the problem is really with
the use of ptr_fun with functions returning references, not with


 Jeremy Siek
 Ph.D. Student, Indiana Univ. B'ton email: jsiek_at_[hidden]
 C++ Booster ( office phone: (812) 855-3608

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