Boost logo

Boost :

From: Nicolas Fleury (nidoizo_at_[hidden])
Date: 2006-06-21 16:16:22


Matt Calabrese wrote:
> On 6/20/06, Nicolas Fleury <nidoizo_at_[hidden]> wrote:
>> Is there something like a is_specialization in Boost.Traits?
>
>>From your example, I believe you mean "is instantation of" not "is
> specialization of". If so, I do agree that such a metafunction would be
> useful, as I find myself rolling my own similar metafunctions every once in
> a while. However, your example incorrectly assumes that char and int are
> different sizes ( sizeof(int) can yield 1 in a compliant C++ implementation
> ).

I totally agree. Yes, that's exactly what I mean.

> (...)
> BOOST_GENERATE_IS_INSTANTIATION_OF
> ( is_boost_array, array, (typename)(::std::size_t) )
>
> // Then use somewhere else
> bool const value = ::boost::is_boost_array< ::boost::array< int, 10 >
>> ::value;

Sounds great. I think that's a good approach.

> /*
> The above macro would have a limitation being that a comma
> cannot appear directly inside one of the sequence elements
> of the last argument (so, i.e. the type can't come from a
> metafunction invocation which takes more than one argument
> explicitly unless additional measures are taken).
> */

I find it reasonable considering a typedef can be used as a workaround.

Regards,
Nicolas


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