Debian Codegraph @

Utilities/std/cm/map

raw
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 <map> // 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 T, typename Compare, typename Allocator,
25 typename Predicate>
26 inline void erase_if(std::map<Key, T, Compare, Allocator>& cont,
27 Predicate pred)
28 {
29 internals::erase_if(cont, pred);
30 }
31
32 template <typename Key, typename T, typename Compare, typename Allocator,
33 typename Predicate>
34 inline void erase_if(std::multimap<Key, T, Compare, Allocator>& cont,
35 Predicate pred)
36 {
37 internals::erase_if(cont, pred);
38 }
39
40 #endif
41
42 } // namespace cm