| Thread overview | ||||||
|---|---|---|---|---|---|---|
|
December 25, 2013 Interfaces based on TypeTuple? | ||||
|---|---|---|---|---|
| ||||
How can I achieve something like the following? I want to create a class B that has all the interfaces of the class passed as a template parameter.
import std.trats;
interface I0 {}
interface I1 {}
class A : I0, I1 {}
class B!C : InterfacesTuple!C {}
void main() {
B!A a;
}
| ||||
December 25, 2013 Re: Interfaces based on TypeTuple? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Øivind | On Wednesday, 25 December 2013 at 07:45:37 UTC, Øivind wrote:
> How can I achieve something like the following? I want to create a class B that has all the interfaces of the class passed as a template parameter.
>
> import std.trats;
>
> interface I0 {}
> interface I1 {}
>
> class A : I0, I1 {}
>
> class B!C : InterfacesTuple!C {}
>
> void main() {
> B!A a;
> }
The above fails with the following error on DMD 2.064.2
/d925/f379.d(8): Error: { } expected following aggregate
declaration
/d925/f379.d(8): Error: Declaration expected, not '!'
/d925/f379.d(12): Error: unrecognized declaration
| |||
December 25, 2013 Re: Interfaces based on TypeTuple? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Øivind | On Wednesday, 25 December 2013 at 07:45:37 UTC, Øivind wrote:
> class B!C : InterfacesTuple!C {}
You probably meant:
class B(C) : InterfacesTuple!C {}
| |||
December 25, 2013 Re: Interfaces based on TypeTuple? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Jakob Ovrum | On Wednesday, 25 December 2013 at 07:49:35 UTC, Jakob Ovrum wrote:
> On Wednesday, 25 December 2013 at 07:45:37 UTC, Øivind wrote:
>> class B!C : InterfacesTuple!C {}
>
> You probably meant:
>
> class B(C) : InterfacesTuple!C {}
Yes, stupid typo. Thanks for the quick answer. Awesome that this works :)
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply