Skip to content

Instantly share code, notes, and snippets.

@motonacciu
Last active August 29, 2015 14:24
Show Gist options
  • Select an option

  • Save motonacciu/26fa2efed62db771e936 to your computer and use it in GitHub Desktop.

Select an option

Save motonacciu/26fa2efed62db771e936 to your computer and use it in GitHub Desktop.
std::vector<Object> dst_objs;
// transform an iterator into a moveable one
auto it = std::make_move_iterator(src_objs.begin()),
end = std::make_move_iterator(src_objs.end());
std::copy_if(it, end, std::back_inserter(dst_objs),
[](const Object& cur) { return cur.type() == Type::TYPE1; });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment