Boost logo

Boost :

Subject: Re: [boost] [type_traits] templated type traits?
From: Matt Calabrese (rivorus_at_[hidden])
Date: 2012-11-09 23:45:22


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.

-- 
-Matt Calabrese

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