STL stupid question
-
Hi, I have the following struct:
typedef struct _MyStruct { int one; int two; } *pMyStruct, MyStruct;
from which I constructed vector:typedef std::vector MyStructContainer; typedef std::vector::iterator MyStructIter;
In the one of my functions, I walk through all elements of vector:MyStructContainer c; MyStructIter iter; pMyStruct p; for (iter = c.begin(); iter != c.end(); iter++) { // here I want to get a pointer to MyStruct by iter. How? };
How to get a pointer to MyStruct by iterator? Sincerely Yours, RadioShark -
Hi, I have the following struct:
typedef struct _MyStruct { int one; int two; } *pMyStruct, MyStruct;
from which I constructed vector:typedef std::vector MyStructContainer; typedef std::vector::iterator MyStructIter;
In the one of my functions, I walk through all elements of vector:MyStructContainer c; MyStructIter iter; pMyStruct p; for (iter = c.begin(); iter != c.end(); iter++) { // here I want to get a pointer to MyStruct by iter. How? };
How to get a pointer to MyStruct by iterator? Sincerely Yours, RadioSharkp=&(*iter);
Hope this helps. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo