add a find(container, value) utility function
This commit is contained in:
parent
e386c49868
commit
14d17a4493
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user