You can use two vectors: one storage component a, one storage component binstead of one vector storing pairs ( a, b).
If this does not work for you, you can do something like this (this is C ++ 11 or higher):
std::for_each(vec.begin(), vec.end(),
[] (myStruct &v) {std::cout << v.a << '\n';} );
( ) , for.