Dear Veronica,
what about your mentioned alternative of anonymous unions and structs?
They could be made standard-compliant.
And would need less language changes.
Would they have problems with UB due to which element is the active one? When used in your use case?
Best regards,
Sebastian
-----Ursprüngliche Nachricht-----
Von: veronica alphonso via Std-Proposals <std-proposals@lists.isocpp.org>
Gesendet: Do 07.03.2024 23:55
Betreff: [std-proposals] Subscript aliasing
An: std-proposals@lists.isocpp.org;
CC: veronica alphonso <verodeving@gmail.com>;
In C++ there isn't a standard-compliant way of creating named aliases of c-like array elements. In certain contexts, it is preferred to access these these array elements with a named identifier that is bounded to that particular array entry, e.g:
union
{
float my_vec[3];
struct
{
float x, y, z;
};
};
However, anonymous structs/classes are only-- Std-Proposals mailing list Std-Proposals@lists.isocpp.org https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals