PlasmaActivities

remove_if.h
1/*
2 SPDX-FileCopyrightText: 2012 Ivan Cukic <ivan.cukic(at)kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#ifndef UTILS_REMOVE_IF_H
8#define UTILS_REMOVE_IF_H
9
10#include <algorithm>
11
12/********************************************************************
13 * Syntactic sugar for the erase-remove idiom *
14 ********************************************************************/
15
16namespace kamd
17{
18namespace utils
19{
20template<typename Collection, typename Filter>
21__inline void remove_if(Collection &collection, Filter filter)
22{
23 collection.erase(std::remove_if(collection.begin(), collection.end(), filter), collection.end());
24}
25
26} // namespace utils
27} // namespace kamd
28
29#endif // UTILS_REMOVE_IF_H
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Feb 28 2025 12:01:06 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.