Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2002-03-13 17:57:31

I am solving this problem, and considerably simplifying the type_traits
workaround implementations to boot. If you want a preview, have a look
at composite_traits.hpp from the CVS.

template <class T> T(*

no_type helper2(T&(*)(type<T>));
yes_type helper2(...);

template <class T>
struct is_array
    BOOST_STATIC_CONSTANT(bool, value = helper2(helper1(type<T>())));

How this works, as far as I can tell:

* helper1 returns a pointer-to-function accepting type<T> and returning
* when T is an array type, that's illegal, so MSVC turns it into a
function returning T*
* only helper2(...) will match that transformed function pointer.


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