'typeof' question

DLearner bmqazwsx123 at gmail.com
Tue Nov 28 18:41:49 UTC 2023


Trying to manipulate 'typeof' return strings, preferably at 
compile-time.

e.g. to produce struct B below (intended to have an A 
sub-struct), from A_Ptr alone.
```
struct A {
    int AFld1;
}
A* A_Ptr;

struct B {
    int BFld2;
    typeof(A_Ptr)[0..($-1)] ASUB; // Idea is ASUB of type A, from 
A_Ptr of type A*.
}
```
But this fails with 'can only slice tuple types...'.

Suggestions?



More information about the Digitalmars-d-learn mailing list