I have a Vector4 class I created, that has x, y, z, and w, however I also want to be able to index this class (vec[0] = x, vec[1] =y, etc.)
i can't figure out how to do this without using functions (vec.x()), however I really want to be able to use vec[0] and vec.x, without ()
i have also been told that overriding the [] operator and using a switch statement would be slower, and my code is performance critical. is there any way to do this? maybe with references?