Re: Structure's inheritance

2013-05-13 Thread Dicebot
I believe template mixin are the way to go for structs. Small annotated example: // http://dpaste.1azy.net/56dd2513 mixin template Operators() { // Verify a field exists for better compile-time error. Hard-coded here. // As an alternative, name of field to use can be provided as a template

Structure's inheritance

2013-05-12 Thread Temtaime
Hello to all ! I'm surprised that there is no structure's inheritance. There is a problem: I want to make Matrix MxN class. I also want to make child classes Square Matrix and Vector from it with additional functions. I don't want use class cause of new overhead. Std typecons's Scoped

Re: Structure's inheritance

2013-05-12 Thread evilrat
On Sunday, 12 May 2013 at 11:21:16 UTC, Temtaime wrote: Hello to all ! I'm surprised that there is no structure's inheritance. There is a problem: I want to make Matrix MxN class. I also want to make child classes Square Matrix and Vector from it with additional functions. I don't want use

Re: Structure's inheritance

2013-05-12 Thread Namespace
On Sunday, 12 May 2013 at 11:21:16 UTC, Temtaime wrote: Hello to all ! I'm surprised that there is no structure's inheritance. There is a problem: I want to make Matrix MxN class. I also want to make child classes Square Matrix and Vector from it with additional functions. I don't want use

Re: Structure's inheritance

2013-05-12 Thread Maxim Fomin
On Sunday, 12 May 2013 at 11:21:16 UTC, Temtaime wrote: Hello to all ! I'm surprised that there is no structure's inheritance. This was done by Walter Bright deliberately because he believes that polymorphism does not play well with automaic lifetime. There is a problem: I want to make

Re: Structure's inheritance

2013-05-12 Thread evilrat
On Sunday, 12 May 2013 at 11:56:53 UTC, Maxim Fomin wrote: You can place base struct instance inside nested and use alias this. Note that currently multiple alias this are not supported. Also note that you cannot override functions because there are no virtual table for structs. why

Re: Structure's inheritance

2013-05-12 Thread Dmitry Olshansky
12-May-2013 16:00, evilrat пишет: On Sunday, 12 May 2013 at 11:56:53 UTC, Maxim Fomin wrote: You can place base struct instance inside nested and use alias this. Note that currently multiple alias this are not supported. Also note that you cannot override functions because there are no virtual

Re: Structure's inheritance

2013-05-12 Thread Simen Kjaeraas
On 2013-05-12, 14:00, evilrat wrote: On Sunday, 12 May 2013 at 11:56:53 UTC, Maxim Fomin wrote: You can place base struct instance inside nested and use alias this. Note that currently multiple alias this are not supported. Also note that you cannot override functions because there are no

Re: Structure's inheritance

2013-05-12 Thread Jonathan M Davis
On Sunday, May 12, 2013 14:00:49 evilrat wrote: why multiple alias this not supported? i know it was broken in 2.060 but with 2.061 it was fixed right? Multiple alias this-es have never worked. They're described in TDPL, but they've never been implemented. Hopefully, they'll get implemented at