Reputation: 3434
I have a std::map
of HANDLE
objects,
std::map<int, HANDLE> MyMap;
I have to wait on these handle objects using WaitForMultipleObjects() function. For that i have to get the map contents as an array of HANDLE objects.(if it was a vector, then we can use vector.data() function). And I am looking for such a simple function to achieve this.
Upvotes: 1
Views: 145
Reputation: 490028
Assuming you're using a reasonably recent version of VC++ (2010 or 2012), or g++ (4.6 or newer), you should be able to do something like this:
std::vector<HANDLE> handles;
std::transform(your_map.begin(), your_map.end(),
std::back_inserter(handles),
[](std::pair<const int, HANDLE> const &i) { return i.second; });
Upvotes: 6
Reputation: 1248
Upvotes: 1