diff --git a/src/blackmisc/containerbase.h b/src/blackmisc/containerbase.h index ce020a9c3..393b0c779 100644 --- a/src/blackmisc/containerbase.h +++ b/src/blackmisc/containerbase.h @@ -92,6 +92,16 @@ namespace BlackMisc return findBy([ & ](const T &value) { return value == valueMap; }); } + /*! + * \brief Return true if there is an element equal to given object + * \param object is this object in container? + * \return + */ + bool contains(const T &object) const + { + return std::binary_search(derived().begin(), derived().end(), object); + } + /*! * \brief Return true if there is an element for which a given predicate returns true * \param p @@ -104,7 +114,7 @@ namespace BlackMisc } /*! - * \brief Return a copy containing only those elements matching a particular key/value pair. + * \brief Return true if there is an element matching a particular key/value pair. * \param key1 A pointer to a member function of T. * \param value1 Will be compared to the return value of key1. * \return