fix contains for empty containers
This commit is contained in:
parent
3171ab0c52
commit
f8209e3b52
|
@ -159,7 +159,7 @@ auto find_if(Container& container, T op) -> decltype(container.begin())
|
||||||
template<typename Container, typename T>
|
template<typename Container, typename T>
|
||||||
bool contains(const Container& container, const T& value)
|
bool contains(const Container& container, const T& value)
|
||||||
{
|
{
|
||||||
return find(container, value) != container.end();
|
return (not container.empty()) and find(container, value) != container.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
// *** On scope end ***
|
// *** On scope end ***
|
||||||
|
|
Loading…
Reference in New Issue
Block a user