How to update multiple fields of a struct simultaneously?

  accessor, c++, field, struct

Let’s say I have a struct

struct Vector3 {
    float x;
    float y;
    float z;
};

Note that sizeof(Vector3) must remain the same

Not let’s create an instance of that struct Vector3 pos . How can I implement my struct so I can have something like this pos.xy = 10 // updates x and y or pos.yz = 20 // updates y and z or pos.xz = 30 // updates x and z?

Source: Windows Questions C++

LEAVE A COMMENT