Boost logo

Boost :

From: Daniel Frey (d.frey_at_[hidden])
Date: 2003-02-14 18:33:04

On Fri, 07 Feb 2003 12:48:13 +0100, John Maddock wrote:

>>Why can't I see them?? Look at:
> OK the implementation is:
> (::boost::type_traits::ice_and<
> ::boost::type_traits::ice_not< ::boost::is_union<T>::value
> >::value, ::boost::type_traits::ice_not<
> ::boost::is_scalar<T>::value
> ::boost::type_traits::ice_not< ::boost::is_array<T>::value
> >::value, ::boost::type_traits::ice_not<
> ::boost::is_reference<T>::value>::value,
> ::boost::type_traits::ice_not< ::boost::is_void<T>::value
> >::value, ::boost::type_traits::ice_not<
> ::boost::is_function<T>::value
> >::value));
> Note the is_scalar: this takes care of int's floats, pointers and member
> pointers.

After thinking about it longer, I still think that there is a problem. The
code seems "twisted" to me. Let me try to explain it, I start by some
observations (all for the case of

is_scalar is based on 3.9/10, which says that enums are scalars.
Currently, is_scalar doesn't detect enums.

is_class needs is_scalar

is_enum needs is_class or it will detect classes which are convertible to
int as enums.

I think we should still consider that we try to provide a conforming
is_class implementation for as much compilers as possible. We should also
consider to fix is_scalar.

There are some further problems, e.g. is_class< int( int ) >::value fails
to compile instead of giving me 'false'. I have to find a solution, but it
surely exists.

A last general question: It seems to me that the boost type-traits are a
mixture of two very different concepts: One concept is that of a classic
"utility library". This means, that it provides things I can use when I
like, but they don't affect my code in general. The other concept is that
of a "framework". In order to use is_union, has_* and some other
functions, I have to flag my classes, that means I have to write my code
in a "boost-friendly" way in order to make it work. I think that it might
be worth to make a very clear distinction between these two parts.

Regards, Daniel

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