|
Boost : |
From: Howard Hinnant (hinnant_at_[hidden])
Date: 2000-12-22 09:28:53
Although I find your suggested implementation of add_reference elegant
(and even prefer it for asthetic reasons), I'm failing to see what is
wrong with the current implementation:
template <typename T> struct add_reference{ typedef T& type; };
template <typename T> struct add_reference<T&>{ typedef T& type; };
-Howard
Aleksey Gurtovoy wrote on 12/22/2000 7:34 AM
>
>Another thought about 'ob_type_traits.hpp' header, since we are on the
>subject :). Right now it does not properly implement 'add_reference' (and
>non-existing 'add_pointer' ;)
>
>// current version
>template <typename T> struct add_reference{ typedef T& type; };
>
>...although it certainly could:
>
>template <typename T>
>struct add_reference {
> typedef typename ct_if<is_reference<T>::value, T&, T>::type type;
>};
>
>template <typename T>
>struct add_pointer {
> typedef typename ct_if<is_pointer<T>::value, T*, T>::type type;
>};
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk