| Thread overview | ||||||
|---|---|---|---|---|---|---|
|
August 17, 2015 Getting a TypeTuple of a Template's Arguments | ||||
|---|---|---|---|---|
| ||||
For functions, we have std.traits.ParameterTypeTuple. Is there any equivalent functionality for templates? | ||||
August 17, 2015 Re: Getting a TypeTuple of a Template's Arguments | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Meta | Aside: With 2.068, std.typetuple and TypeTuple are renamed as std.meta and AliasSeq, respectively.
On 08/17/2015 02:23 PM, Meta wrote:> For functions, we have std.traits.ParameterTypeTuple. Is there any
> equivalent functionality for templates?
There is TemplateArgsOf for instances of templates but I don't know anything more meta :) than that:
import std.traits;
void foo(int i, alias f, T)()
{}
void main()
{
int bar(int) { return 0; }
alias f = foo!(42, bar, int);
pragma(msg, TemplateArgsOf!(f));
}
Prints
tuple(42, bar, (int))
Ali
| |||
August 18, 2015 Re: Getting a TypeTuple of a Template's Arguments | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Meta | On Monday, 17 August 2015 at 21:23:49 UTC, Meta wrote:
> For functions, we have std.traits.ParameterTypeTuple. Is there any equivalent functionality for templates?
I've recently searched for this thing and haven't found anything for uninstantiated templates, only for instantiated.
| |||
August 18, 2015 Re: Getting a TypeTuple of a Template's Arguments | ||||
|---|---|---|---|---|
| ||||
Posted in reply to thedeemon | On Tuesday, 18 August 2015 at 07:41:00 UTC, thedeemon wrote:
> On Monday, 17 August 2015 at 21:23:49 UTC, Meta wrote:
>> For functions, we have std.traits.ParameterTypeTuple. Is there any equivalent functionality for templates?
>
> I've recently searched for this thing and haven't found anything for uninstantiated templates, only for instantiated.
As I'd thought. I can't think of a way to do it, either, so I guess that's a no-go for the time being.
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply