On Sunday, 25 September 2016 at 04:54:31 UTC, grampus wrote:
Dear allFor example, I have a struct struct point{int x;int y} point a;Is there an easy way to access x and y by using a["x"] and a["y"]I guess I need to overload [], but can't figure out how. Someone can help? Thank you very much
The way you access the memers of a struct is through the dot syntax.
i.e. a.x = a.y;
Is there an easy way to access x and y by using a["x"] and a["y"]
in this case "x" and "y" are strings so no.