Here is the code from b2Math.h from the Box2d physics engine.
An error message appears in the copy and paste of the Box2D source code. In particular, the missing ampersand in the non-constant method is apparently missing.
In addition, this code fragment appears from a code base different from the current released code 2.3.2.
Box2D 2.3.2 GitHub:
float32 operator () (int32 i) const
{
return (&x)[i];
}
float32& operator () (int32 i)
{
return (&x)[i];
}
SomeVector.x SomeVector.y / ?
, .
Box2D (b2AABB::RayCast), , -, ( b2AABB::RayCast, " , p179" ), x y . , ( Box2D) : (a) , (b) (c) . , .
Box2D, . [] ( ()) switch x y. , , , undefined w.r.t. ++.
, (, , , , , , , ):
auto operator[] (size_type i) const
{
assert(i < max_size());
switch (i)
{
case 0: return x;
case 1: return y;
default: break;
}
return x;
}
auto& operator[] (size_type i)
{
assert(i < max_size());
switch (i)
{
case 0: return x;
case 1: return y;
default: break;
}
return x;
}
(& x) [i]; ?
, .
, x y- , ; . , (&) x, , i.
, , , ++. .
, .