#include <iostream>
#include <vector>
struct A
{
int B, C, D;
};
void f(std::vector<A> va, int A::*m)
{
for(A &a : va)
{
std::cout << a.*m << std::endl;
}
}
int main()
{
std::vector<A> va =
{
{1, 2, 3},
{4, 5, 6},
{7, 8, 9}
};
f(va, &A::B);
f(va, &A::D);
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgoKc3RydWN0IEEKewogICAgaW50IEIsIEMsIEQ7Cn07Cgp2b2lkIGYoc3RkOjp2ZWN0b3I8QT4gdmEsIGludCBBOjoqbSkKewoJZm9yKEEgJmEgOiB2YSkKCXsKCQlzdGQ6OmNvdXQgPDwgYS4qbSA8PCBzdGQ6OmVuZGw7Cgl9Cn0KCmludCBtYWluKCkKewoJc3RkOjp2ZWN0b3I8QT4gdmEgPQoJewoJCXsxLCAyLCAzfSwKCQl7NCwgNSwgNn0sCgkJezcsIDgsIDl9Cgl9OwoJZih2YSwgJkE6OkIpOwoJZih2YSwgJkE6OkQpOwp9Cg==