mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-18 03:15:34 +08:00
containers: added methods contains(), remove(), replace(), replaceOrAdd(),
corresponding to contains(), removeIf(), replaceIf(), and replaceOrAdd(), but overloaded for const T& as well as for predicates. refs #106
This commit is contained in:
@@ -94,6 +94,16 @@ namespace BlackMisc
|
||||
return std::any_of(derived().begin(), derived().end(), p);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \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::find(derived().begin(), derived().end(), object) != derived().end();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Return a copy containing only those elements matching a particular key/value pair.
|
||||
* \param key1 A pointer to a member function of T.
|
||||
|
||||
Reference in New Issue
Block a user