Boost logo

Boost :

From: Howard Hinnant (hinnant_at_[hidden])
Date: 2000-10-30 16:58:01

John Maddock wrote on 10/28/2000 7:27 AM
>1) All the templates will be insensitive to cv-qualifiers, except for those
>like has_trivial_xxxx, which *must* take cv-qualifiers into account.

"All" makes me a little nervous. I would expect is_same<int,const
int>::value to be false. I suspect you were not speaking of is_same when
you said "All", but I thought I'd better double check.

>3) depreciate the is_standard_xxx and is_extension_xxx templates - really
>just to simplify the library - is anyone using these?

I'm not using them.

How about adding:


Admittedly you should also be able to get this info from numeric_limits.
But is_signed is arguably more convenient.

template <class T> struct is_signed
        {static const bool value = T(-1) < T(0);};

And adding:


True for built-in types that are not standard such as long long or
_int64. is_extension is relatively easy to have and maintain compared to
is_extension_xxx. long long would also answer true to is_integral and

Just browsing the remove_xxx series. How about remove_pointer? Removes
top level pointer if present.

template <class T> struct remove_pointer {typedef T
template <class T> struct remove_pointer<T*> {typedef T
template <class T> struct remove_pointer<T*const> {typedef T
template <class T> struct remove_pointer<T*volatile> {typedef T
template <class T> struct remove_pointer<T*const volatile> {typedef T

And then remove_all is also cute: remove cv, references, arrays, and
pointers until you are left with a fundamental, enum, union, class or
member pointer.

namespace details

        template <class T>
        struct strip
                typedef typename remove_cv<
                        typename remove_pointer<
                                typename remove_reference<
                                        typename remove_bounds<T>::type
>::type type;

        template <class T, class U>
        struct strip_aux
                typedef typename strip_aux<typename strip<T>::type, typename
strip<U>::type>::type type;

        template <class T>
        struct strip_aux<T, T>
                typedef T type;


template <class T>
struct remove_all
        typedef typename details::strip_aux<T, typename
details::strip<T>::type>::type type;

remove_all can be used to build stuff like has_extension (or has_integral
or has_floating). Returns true if type is composed of an extension:

template <class T> struct has_extension
        static const bool value = is_extension<typename

I'm not suggesting has_extension. I'm just demonstrating a use for


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