add a find(container, value) utility function

This commit is contained in:
Maxime Coste 2012-01-25 22:31:47 +00:00
parent e386c49868
commit 14d17a4493

View File

@ -100,11 +100,16 @@ private:
template<typename T>
T* Singleton<T>::ms_instance = nullptr;
template<typename Container, typename T>
auto find(Container& container, const T& value) -> decltype(container.begin())
{
return std::find(container.begin(), container.end(), value);
}
template<typename Container, typename T>
bool contains(const Container& container, const T& value)
{
return std::find(container.begin(), container.end(), value)
!= container.end();
return find(container, value) != container.end();
}
inline std::string str_to_str(const std::string& str)