Anonymous structure
Tofu Ninja via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Apr 17 20:57:26 PDT 2016
On Monday, 18 April 2016 at 03:33:53 UTC, Adam D. Ruppe wrote:
> The struct inside union is the main pure-language use case I
> know of though.
Actually curiously I found another potential use, applying
attributes/UDAs to multiple members at once.
enum testUDA;
struct T{
@testUDA
immutable struct{
int x;
int y;
int z;
}
}
x,y,and z seem to all be immutable and all have the UDA testUDA.
But even odder, it seems that "struct" in there is doing
absolutely nothing. The same thing can be done with
enum testUDA;
struct T{
@testUDA
immutable{
int x;
int y;
int z;
}
}
So it still seems to be useless other than in the case of
unions...
More information about the Digitalmars-d-learn
mailing list