Skip to content

Instantly share code, notes, and snippets.

@30mb1
Created December 10, 2015 07:24
Show Gist options
  • Save 30mb1/af0a121e7581c637e4e4 to your computer and use it in GitHub Desktop.
Save 30mb1/af0a121e7581c637e4e4 to your computer and use it in GitHub Desktop.
B1
template <typename SourceIterator, typename DestinationIterator, typename Predicate>
DestinationIterator copy_backward_if(SourceIterator source_first, SourceIterator source_last, DestinationIterator destination_last, Predicate condition) {
while (source_last != source_first) {
if (condition(*source_first)) {
*(--destination_last) = *source_first;
}
++source_first;
}
return destination_last;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment