| 1 |
// -*-c++-*- |
| 2 |
// vim: set ft=cpp: |
| 3 |
|
| 4 |
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying |
| 5 |
file LICENSE.rst or https://cmake.org/licensing for details. */ |
| 6 |
#pragma once |
| 7 |
|
| 8 |
#include <unordered_set> // IWYU pragma: export |
| 9 |
|
| 10 |
#include <cm/bits/container_helpers.hxx> // IWYU pragma: export |
| 11 |
#include <cm/bits/erase_if.hxx> |
| 12 |
|
| 13 |
namespace cm { |
| 14 |
|
| 15 |
// should be updated when C++20 is finalized |
| 16 |
#if (__cplusplus > 201703L || \ |
| 17 |
(defined(_MSVC_LANG) && _MSVC_LANG > 201703)) && \ |
| 18 |
defined(__cpp_lib_erase_if) |
| 19 |
|
| 20 |
using std::erase_if; |
| 21 |
|
| 22 |
#else |
| 23 |
|
| 24 |
template <typename Key, typename Hash, typename KeyEqual, typename Allocator, |
| 25 |
typename Predicate> |
| 26 |
inline void erase_if(std::unordered_set<Key, Hash, KeyEqual, Allocator>& cont, |
| 27 |
Predicate pred) |
| 28 |
{ |
| 29 |
internals::erase_if(cont, pred); |
| 30 |
} |
| 31 |
|
| 32 |
template <typename Key, typename Hash, typename KeyEqual, typename Allocator, |
| 33 |
typename Predicate> |
| 34 |
inline void erase_if( |
| 35 |
std::unordered_multiset<Key, Hash, KeyEqual, Allocator>& cont, |
| 36 |
Predicate pred) |
| 37 |
{ |
| 38 |
internals::erase_if(cont, pred); |
| 39 |
} |
| 40 |
|
| 41 |
#endif |
| 42 |
|
| 43 |
} // namespace cm |