Hi all,
I'm a bit stumped about the idea of returning a reference to an array inside a struct. For example,
I can use the overload to access x and y by using their corresponding subscripts. But how does that work? I understand incrementing a pointer to x will give me y if I dereference it. The overall syntax of that return confuses me.Code:struct MyStruct { float x, y; float& operator [](int i) { return ((&x)[i]); // this confuses me }
Hope someone can help me