Boost logo

Boost :

From: Jonathan Turkanis (technews_at_[hidden])
Date: 2004-01-24 00:49:57


I have noticed that is_array and remove_bounds do not seem to work
with array types of unknown bounds; e.g.,

    BOOST_STATIC_ASSERT(!boost::is_array< int[] >::value);
    BOOST_STATIC_ASSERT((boost::is_same< boost::remove_bounds< int[]
>::type, int[]>::value));

compile on GCC 3.2 and VC7.1. Is this the desired behavior?
Intuitively, I would expect

    BOOST_STATIC_ASSERT(boost::is_array< int[] >::value);
    BOOST_STATIC_ASSERT((boost::is_same< boost::remove_bounds< int[]
>::type, int>::value));

to compile.

I'm not familiar with the macros used by the type traits library, but
I made a wild gues and found that inserting

    BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename
T,is_array,T[],true)
    BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_array,T
const[],true)
    BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_array,T
volatile[],true)
    BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_array,T
const volatile[],true)

at line 35 of "is_array.hpp" and

    BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename
T,remove_bounds,T[],T)
    BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_bounds,T
const[],T const)
    BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_bounds,T
volatile[],T volatile)
    BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_bounds,T
const volatile[],T const volatile)

at line 23 of "remove_bounds.hpp" seems to work.

Jonathan


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