Last active
August 29, 2015 14:13
-
-
Save superwills/45a259c41469d94d4a95 to your computer and use it in GitHub Desktop.
contains
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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