Class / array question

Started by
9 comments, last by DividedByZero 8 years, 6 months ago

You can iterate a std::vector like a normal array using the subscript operator (square brackets)


mObject->vertices[0] // returns the first vertex

Vector is a weird name for that container, especially if you are coming from a math/graphics background.

std::vector is just a dynamic array that you can resize and it manages the memory for you.

You can call vertices.size() to get the number of vertices, vertices.push_back(vertex) to append a new vertex and more cool stuff.

I'd suggest you go through a beginner's tutorial for the stl container classes as they are a fundamental building block of modern c++.

Advertisement
Ok awesome! Thanks again for your help smile.png

This topic is closed to new replies.

Advertisement