Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // position is the std::vector<int> of index position
- // src.erase(byIndices(src, begin(position), end(position)), src.end());
- // position.clear();
- template<typename Cont, typename It>
- auto iterByIndices(Cont &cont, It beg, It end) -> decltype(std::end(cont))
- {
- int helpIndx(0);
- return std::stable_partition(std::begin(cont), std::end(cont),
- [&](decltype(*std::begin(cont)) const& val) -> bool {
- return std::find(beg, end, helpIndx++) == end;
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement