mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-17 02:45:33 +08:00
Contains method of const T &object
This commit is contained in:
@@ -92,6 +92,16 @@ namespace BlackMisc
|
|||||||
return findBy([ & ](const T &value) { return value == valueMap; });
|
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
|
* \brief Return true if there is an element for which a given predicate returns true
|
||||||
* \param p
|
* \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 key1 A pointer to a member function of T.
|
||||||
* \param value1 Will be compared to the return value of key1.
|
* \param value1 Will be compared to the return value of key1.
|
||||||
* \return
|
* \return
|
||||||
|
|||||||
Reference in New Issue
Block a user