Consider the following struct
struct Pair
{
int a;
std::string b;
};
I have a std::vector<Pair> pairs but I want a std::vector<std::string> listOfBFromPairs which contains all the values of b from the list of pairs.
I would like to do this in a one-liner.
I have used OpenGL before and I have previously created a struct, specified a starting point
pairs.begin() + offsetof(Pair, b)
and given a stride length (the size of the pair object in memory) and the number of things I want to parse and it has done what I am after here.
Is this possible here too using c++ iterators?
The specific use case I have is I want to make an unordered set of Vulkan extension names but Vulkan returns structs which contain the extension name as a member. I will then use the unordered set to check against extensions my application would like to use.