Contains method of const T &object

This commit is contained in:
Klaus Basan
2014-01-21 02:39:44 +01:00
parent 3769ad1e65
commit a69fb246f5

View File

@@ -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