Boost logo

Boost :

From: Eric Niebler (neric_at_[hidden])
Date: 2003-03-20 16:24:23

The way call_traits is currently implemented, call_traits<int&>::value_type
is an int&, not an int. It seems to run contrary to the rationale given in :

"Defines a type that represents the "value" of type T. Use this for
functions that return by value, or possibly for stored values of type T."

Also, it runs contrary to standard practice. In several places in the
standard library "value_type" is assumed to be a value, not a reference. For
instance, std::stack is defined as :

template<typename T, typename Cont = deque<T> >
class stack
    typedef typename Cont::value_type value_type;
    value_type & top();

For this to work, value_type can never be a reference. Likewise for
iterator_traits::value_type. As it is often used to declare temporary
variables in algorithms, it would be very bad if it were allowed to be a
reference, creating aliases instead of temporaries. (I can't find where in
the standard iterator_traits::value_type is actually required to be a true
value type instead of a reference, though.)

Is this an oversight in call_traits? Or just an unfortunately named


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