Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-10-17 07:13:50


From: "Aleksey Gurtovoy" <agurtovoy_at_[hidden]>
> One particular reason why I am raising this question is that a simple and
> clean 'is_class' implementation below (based on Paul Mensonides work)
> naturally gives you a positive answer on union arguments as well:
>
> // from boost/type_traits/is_class.hpp
> template <typename T>
> struct is_class_impl
> {
> template <class U> static ::boost::type_traits::yes_type
> is_class_tester(void(U::*)(void));
> template <class U> static ::boost::type_traits::no_type
> is_class_tester(...);
>
> BOOST_STATIC_CONSTANT(bool, value =
> sizeof(is_class_tester<T>(0)) ==
> sizeof(::boost::type_traits::yes_type)
> );
> };
>
> We either need to make it conform to our current 'is_class' definition by
> explicitly handling that case, or fix the definition.

I think that the current state of affairs is correct, as the above yields
true for incomplete class types. There is no way to tell whether an
incomplete class is a union.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk