From f8209e3b5211ad852c1d61a90eab09f5b4db6ab1 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Tue, 29 Jan 2013 18:55:32 +0100 Subject: [PATCH] fix contains for empty containers --- src/utils.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils.hh b/src/utils.hh index 2bf0ce80..f9e72703 100644 --- a/src/utils.hh +++ b/src/utils.hh @@ -159,7 +159,7 @@ auto find_if(Container& container, T op) -> decltype(container.begin()) template 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 ***