for_each on a COM IEnumXxx interface?
-
19-08-2019 - |
Question
I've got a COM object that returns an IEnumUnknown. Is there anything out there that'll turn it into an STL-style iterator? So that I can do something like this:
IEnumUnkPtr pEnumUnk;
// ...something that fills in pEnumUnk...
MagicThing m(pEnumUnk);
std::for_each(m.begin(), m.end(), DoSomethingWithUnk);
...or similar?
Solution
Seems like the comstl project has what you need: http://www.stlsoft.org/doc-1.9/classcomstl_1_1enumerator__sequence.html
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow