Skip to content

Instantly share code, notes, and snippets.

@OndrejSlamecka
Created July 12, 2014 10:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save OndrejSlamecka/0c304786dd5d4c24fe4d to your computer and use it in GitHub Desktop.
Save OndrejSlamecka/0c304786dd5d4c24fe4d to your computer and use it in GitHub Desktop.
C++ contains (not tested)
template <template <class> class C, typename T>
bool contains(C<T> container, T item) {
return std::find(container.begin(), container.end(), item) != container.end();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment