Skip to content

Instantly share code, notes, and snippets.

@superwills
Last active August 29, 2015 14:13
Show Gist options
  • Save superwills/45a259c41469d94d4a95 to your computer and use it in GitHub Desktop.
Save superwills/45a259c41469d94d4a95 to your computer and use it in GitHub Desktop.
contains
// for a vector
template <typename T> bool contains( const vector<T> &vvector, const T& item )
{
return vvector.find( item ) != vvector.end() ;
}
// for a set
template <typename T> bool contains( const set<T> &sset, const T& item )
{
return sset.find( item ) != sset.end() ;
}
// write more for a list, map, etc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment