Boost logo

Boost :

Subject: Re: [boost] [type_traits] templated type traits?
From: Lorenzo Caminiti (lorcaminiti_at_[hidden])
Date: 2012-11-10 00:24:12


On Fri, Nov 9, 2012 at 8:45 PM, Matt Calabrese <rivorus_at_[hidden]> wrote:
> On Fri, Nov 9, 2012 at 6:45 PM, Lorenzo Caminiti <lorcaminiti_at_[hidden]>wrote:
>
>> Hi,
>>
>> Is there a way to inspect if a type is a template instantiaton
>> (is_templated) and the type of the instantiated template parameters
>> (arg1_type)?
>>
>> is_templated< std::vector<int> >::value // true
>> is_templated< int >::value // false
>>
>> template_traits< std::vector<int> >::arg1_type // int
>
>
> I recently developed a way to do this in the backend of Boost.Generic that
> works even with non-type template parameters or combinations of types an
> non-types, etc., but it requires explicit registration of those kinds of
> "weird" template parameter lists, which might be unacceptable for your
> needs.

Thanks for all the replies. It turns out the solution to the question
I originally asked doesn't help in the context of my original problem
:( but thanks for telling me how to inspect template traits!

--Lorenzo


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