how to access struct member using [] operator?

grampus via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Sep 24 21:54:31 PDT 2016


Dear all

For 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




More information about the Digitalmars-d-learn mailing list