mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-13 15:45:42 +08:00
moved removeIf from CContainerBase to CSequence because it can't work with non-sequential containers, fixes #106
This commit is contained in:
@@ -105,26 +105,6 @@ namespace BlackMisc
|
|||||||
return contains(BlackMisc::Predicates::MemberEqual<T>(key1, value1));
|
return contains(BlackMisc::Predicates::MemberEqual<T>(key1, value1));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Remove elements for which a given predicate returns true.
|
|
||||||
*/
|
|
||||||
template <class Predicate>
|
|
||||||
void removeIf(Predicate p)
|
|
||||||
{
|
|
||||||
std::remove_if(derived().begin(), derived().end(), p);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Remove elements 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.
|
|
||||||
*/
|
|
||||||
template <class K1, class V1>
|
|
||||||
void removeIf(K1 key1, V1 value1)
|
|
||||||
{
|
|
||||||
removeIf(BlackMisc::Predicates::MemberEqual<T>(key1, value1));
|
|
||||||
}
|
|
||||||
|
|
||||||
public: // CValueObject overrides
|
public: // CValueObject overrides
|
||||||
/*!
|
/*!
|
||||||
* \copydoc CValueObject::toQVariant()
|
* \copydoc CValueObject::toQVariant()
|
||||||
|
|||||||
@@ -247,6 +247,26 @@ namespace BlackMisc
|
|||||||
applyIf([ & ](const T &value) { return value == pattern; }, newValues);
|
applyIf([ & ](const T &value) { return value == pattern; }, newValues);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Remove elements for which a given predicate returns true.
|
||||||
|
*/
|
||||||
|
template <class Predicate>
|
||||||
|
void removeIf(Predicate p)
|
||||||
|
{
|
||||||
|
std::remove_if(begin(), end(), p);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Remove elements 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.
|
||||||
|
*/
|
||||||
|
template <class K1, class V1>
|
||||||
|
void removeIf(K1 key1, V1 value1)
|
||||||
|
{
|
||||||
|
removeIf(BlackMisc::Predicates::MemberEqual<T>(key1, value1));
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Replace elements for which a given predicate returns true.
|
* \brief Replace elements for which a given predicate returns true.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user