Warning, file /include/QtCore/q20map.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005 #ifndef Q20MAP_H
0006 #define Q20MAP_H
0007
0008 #include <QtCore/qtconfigmacros.h>
0009
0010 #include <map>
0011 #if __has_include(<memory_resource>)
0012 # include <memory_resource>
0013 #endif
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031 QT_BEGIN_NAMESPACE
0032
0033 namespace q20 {
0034
0035 #if defined(__cpp_lib_erase_if) && __cpp_lib_erase_if >= 202002L
0036 using std::erase_if;
0037 #else
0038
0039
0040
0041
0042 #define MAKE_OVERLOAD(map, allocator) \
0043 template <typename Key, typename T, typename Compare, typename Pred> \
0044 constexpr typename std::map<Key, T, Compare, std::allocator<std::pair<const Key, T>>>::size_type \
0045 erase_if(std::map<Key, T, Compare, std::allocator<std::pair<const Key, T>>> &c, Pred p) \
0046 { \
0047 const auto origSize = c.size(); \
0048 for (auto it = c.begin(), end = c.end(); it != end; ) { \
0049 if (p(*it)) \
0050 it = c.erase(it); \
0051 else \
0052 ++it; \
0053 } \
0054 return origSize - c.size(); \
0055 } \
0056
0057
0058 MAKE_OVERLOAD(map, allocator)
0059 MAKE_OVERLOAD(multimap, allocator)
0060 #ifdef __cpp_lib_polymorphic_allocator
0061 MAKE_OVERLOAD(map, pmr::polymorphic_allocator)
0062 MAKE_OVERLOAD(multimap, pmr::polymorphic_allocator)
0063 #endif
0064
0065 #undef MAKE_OVERLOAD
0066
0067 #endif
0068 }
0069
0070 QT_END_NAMESPACE
0071
0072 #endif