From 50b8fd440e5c7859329cfc639d37b2f03491b769 Mon Sep 17 00:00:00 2001 From: dekken Date: Fri, 13 Nov 2020 12:17:02 +0100 Subject: [PATCH] pure const contains --- include/dict.hpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/dict.hpp b/include/dict.hpp index a15c2a1..b74face 100644 --- a/include/dict.hpp +++ b/include/dict.hpp @@ -227,7 +227,10 @@ struct Dict throw std::runtime_error("cppdict: not a map or not default"); } - bool contains(std::string key) { return isNode() and std::get(data).count(key); } + bool contains(std::string const key) const noexcept + { + return isNode() and std::get(data).count(key); + } std::size_t size() const noexcept {