fix contains for empty containers

This commit is contained in:
Maxime Coste 2013-01-29 18:55:32 +01:00
parent 3171ab0c52
commit f8209e3b52

View File

@ -159,7 +159,7 @@ auto find_if(Container& container, T op) -> decltype(container.begin())
template<typename Container, typename T>
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 ***