Access template parameters?

rsw0x via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Feb 16 10:43:52 PST 2016


On Tuesday, 16 February 2016 at 18:34:40 UTC, Gavin Maye wrote:
> Say you have
>
> class Foo(type1,type2)
> {
>    ....
> }
>
> And a concrete Foo is passed as a parameter to another 
> template, is there a way to get type1 and type2 from Foo so you 
> can use them in the new template... For example..
>
> class Bar(FooType)
> {
>     FooType.type1 DoSomething() { ... }
> }
>
> or Even something like
>
> class Bar(FooType) : Baz!(FooType.type1)
> {
>     FooType.type1 DoSomething() { ... }
> }

If I understand you correctly, you want pattern matching

i.e,
http://dpaste.dzfl.pl/d8de0a004f59


More information about the Digitalmars-d-learn mailing list