Weed пишет:
I should explain why it's important for me:

For example, I am making a matrix object(s)

It should be:
- any size
- with ability of making matrix instance of a given size in compile time.
- ability of creating matrix instance in runtime.

I have decided to make it struct because I need to create matrix
object in compile time. in real program I'll need matricies of
variable size and 3х1, 3х3, 6х6, 3х6 sizes (and may be other).

I want to make matrix template and insert in it with mixin operator
several structures of different sizes (and this structs are not store his dimensions in each instance, of course: variables width and height declared as invariant). By doing this I'll get several different structures (matrix_dynamic, matrix3x3, matrix6x6 etc)

question is how those matricies can interoperate? They does not have
common parent (structures does not have inheritance) , so I can't
make common function for matricies of different sizes opAdd for
example, and have to do functions for all types of matricies.

How should I implement such a class In D properly? It possible in C++, but I like some of the language D


I think could help a static creation objects of classes (including compile-time creation), but it is also impossible now.
For example:

MatrixClass a(3,2);
static MatrixClass a(3,2);

Planned in the future to implement inheritance of structs or the static creation of classes?

Reply via email to