5

Pointer to a vector

view full story
linux-howto

http://www.daniweb.com – Hi guys, I'm having trouble using a pointer to a vector<float>, it doesn't seems to be responding as I'm expecting it to. Probably a silly mistake on my behalf, but would anyone kindly point it out please. vector<float>* t_matrix; ... cout << "get_t_matrices 0: " << Character::anim.get_animations()[j].get_t_matrices()[0].size() << endl; t_matrix = &(Character::anim.get_animations()[j].get_t_matrices()[0]); cout << "t_matrix size: " << (t_matrix)->size() << endl; get_t_matrices() returns a vector<vector<float>> Line 3 outputs "get_t_matrices 0: 16" to the console. But line 5 outputs "t_matrix size: 0". Can anyone explain why t_matrix doesn't seem to be pointing to the value on line 4, please? (General)