-
double operator[](int i) const { return e[i]; } Do these two sentences have the same effect? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
The
This one returns a reference (pointer) to the actual double-precision floating-point value inside the |
Beta Was this translation helpful? Give feedback.
I'm afraid this is some C++ low-level detail that's unfortunately necessary here. We really try to keep C++ specifics to a minimum. This could look quite different in your own code, depending on your language of choice.
To be a bit more concrete, the first form lets you grab elements out of any
vec3
object, likeThe second form lets you change/set vector values, like so: