Access 'X' member in typedef std::vector<sf::Vector2i> FramesCoords

Hi.
How can I access to 'x' member from sf::Vector2i in my typedef?
I try this, but doesn´t work:

1
2
3
4
typedef std::vector<sf::Vector2i> FramesCoords;
FramesCoords *actualframecoords;

cout<<actualframecoords[2].x<<endl
;
Last edited on
Your syntax as wrong. If you want to access member b of object a, the syntax is:

a.b

If a is a pointer to the object, the syntax is:

a->b

EDIT: Also, what's the comma doing in line 4? Do you understand what the comma operator does in C and C++?
Last edited on
Sorry, it was my mistake while i was writting the post.
Anyway, does not work, neither actualframecoords[lastFrame].x nor actualframecoords[lastFrame]->x
Since you've chose to withhold from us the error message you're getting and the definition of sf::Vector2i, there's really no way for us to be able to tell what might be wrong.
The error message:

Error: Frame Coords don't have a member named 'x'

sf::Vector2i have two members, X and Y.
C and C++ are case-sensitive languages. x is not the same as X.
@OP: for some reason you've got a pointer to a vector. In order to use the vector interface, you must dereference the pointer.
Topic archived. No new replies allowed.