Reputation: 734
I've found a code snippet and dont understand what the index [1] and [0] does after the (*object)
the objects:
Edge *edgea = new Edge(vertex_a,triangle);
Edge *edgeb = new Edge(vertex_b,triangle);
the call:
Edge *edgea_opposite = getEdge((*edgea)[1],(*edgea)[0]);
Upvotes: 1
Views: 76
Reputation: 19767
There's no array here. But operator[]
can be overloaded for a class. For instance, std::vector
does so that it can be used like an array.
So Edge
must have overloaded this. We can't tell you what it does, since we don't have the definition, and we don't know if it is from some publicly available library, or is private to your company/project/whatever.
But guessing from the context, I would think someEdge[0]
gets the start of the line segment, and someEdge[1]
gets the end of it. Creating a new Edge
with these swapped around creates the "opposite" edge. Hence the name.
Upvotes: 8