Boost logo

Boost :

From: Howard Hinnant (hinnant_at_[hidden])
Date: 2003-03-20 18:06:41

On Thursday, March 20, 2003, at 05:17 PM, Eric Niebler wrote:

> It's not a compiler thing. Look at the implementation:
> template <typename T>
> struct call_traits<T&>
> {
> typedef T& value_type; // <-- problem here
> typedef T& reference;
> typedef const T& const_reference;
> typedef T& param_type; // hh removed const
> };

Fwiw, I put a version of call_traits into the Metrowerks::lib a couple
of years ago when it was first developed on boost. At that time I gave
call_traits<int&>::value_type the type of int. I also built code based
on that assumption that looks not too different from what Eric posted:

template<class T, class Allocator = single_deleter<T>,
        class Size = number<typename
call_traits<Allocator>::value_type::size_type, 1> >
        class alloc_ptr;

In this class, the Allocator type may be a reference to an allocator
instead of an allocator (and that is a valuable feature I use).
Indeed, that is why I used call_traits here in the first place. In
retrospect, using remove_reference instead of call_traits here would
probably be a better choice...


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