Extracting template parameters
Joseph Rushton Wakeling
joseph.wakeling at webdrake.net
Tue Nov 6 07:25:40 PST 2012
On 11/06/2012 04:20 PM, Joseph Rushton Wakeling wrote:
> The use-case I'm thinking of is a function something like this (somewhat
> pseudo-code-y):
>
> auto fooToBar(FooInstance f)
> {
> Bar!(f.T1, f.T2, f.T3) b;
> // set values etc.
> return b;
> }
>
> Of course the f.T1 notation is my fiction, but it gives the idea of what is
> needed -- is there a means to extract and use template parameters in this way? I
> assume something from std.traits but it's not entirely clear what or how ...
Ideally this solution would work for non-identical lists of template parameters.
E.g. for
Foo(T1, T2, T3, T4)
{
}
Bar(X1, X2)
{
}
I'd like to be able to instantiate something like: Bar!(f.T2, f.T4) [again,
using my fictional notation].
More information about the Digitalmars-d-learn
mailing list