Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-13 09:20:31

0001 // Copyright (C) 2020 The Qt Company Ltd.
0002 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
0003 // Qt-Security score:significant reason:default
0004 
0005 #ifndef QCONTAINERINFO_H
0006 #define QCONTAINERINFO_H
0007 
0008 #include <QtCore/qglobal.h>
0009 #include <type_traits>
0010 
0011 QT_BEGIN_NAMESPACE
0012 
0013 namespace QContainerInfo {
0014 
0015 template<typename C>
0016 using value_type = typename C::value_type;
0017 
0018 template<typename C>
0019 using key_type = typename C::key_type;
0020 
0021 template<typename C>
0022 using mapped_type = typename C::mapped_type;
0023 
0024 template<typename C>
0025 using iterator = typename C::iterator;
0026 
0027 template<typename C>
0028 using const_iterator = typename C::const_iterator;
0029 
0030 // Some versions of Apple clang warn about the constexpr variables below being unused.
0031 QT_WARNING_PUSH
0032 QT_WARNING_DISABLE_CLANG("-Wunused-const-variable")
0033 
0034 template<typename C, typename = void>
0035 inline constexpr bool has_value_type_v = false;
0036 template<typename C>
0037 inline constexpr bool has_value_type_v<C, std::void_t<value_type<C>>> = true;
0038 
0039 template<typename C, typename = void>
0040 inline constexpr bool has_key_type_v = false;
0041 template<typename C>
0042 inline constexpr bool has_key_type_v<C, std::void_t<key_type<C>>> = true;
0043 
0044 template<typename C, typename = void>
0045 inline constexpr bool has_mapped_type_v = false;
0046 template<typename C>
0047 inline constexpr bool has_mapped_type_v<C, std::void_t<mapped_type<C>>> = true;
0048 
0049 template<typename C, typename = void>
0050 inline constexpr bool has_size_v = false;
0051 template<typename C>
0052 inline constexpr bool has_size_v<C, std::void_t<decltype(C().size())>> = true;
0053 
0054 template<typename C, typename = void>
0055 inline constexpr bool has_reserve_v = false;
0056 template<typename C>
0057 inline constexpr bool has_reserve_v<C, std::void_t<decltype(C().reserve(0))>> = true;
0058 
0059 template<typename C, typename = void>
0060 inline constexpr bool has_clear_v = false;
0061 template<typename C>
0062 inline constexpr bool has_clear_v<C, std::void_t<decltype(C().clear())>> = true;
0063 
0064 template<typename, typename = void>
0065 inline constexpr bool has_at_index_v = false;
0066 template<typename C>
0067 inline constexpr bool has_at_index_v<C, std::void_t<decltype(C().at(0))>> = true;
0068 
0069 template<typename, typename = void>
0070 inline constexpr bool has_at_key_v = false;
0071 template<typename C>
0072 inline constexpr bool has_at_key_v<C, std::void_t<decltype(C().at(key_type<C>()))>> = true;
0073 
0074 template<typename, typename = void>
0075 inline constexpr bool can_get_at_index_v = false;
0076 template<typename C>
0077 inline constexpr bool can_get_at_index_v<C, std::void_t<value_type<C>(decltype(C()[0]))>> = true;
0078 
0079 template<typename, typename = void>
0080 inline constexpr bool can_set_at_index_v = false;
0081 template<typename C>
0082 inline constexpr bool can_set_at_index_v<C, std::void_t<decltype(C()[0] = value_type<C>())>> = true;
0083 
0084 template<typename, typename = void>
0085 inline constexpr bool has_push_front_v = false;
0086 template<typename C>
0087 inline constexpr bool has_push_front_v<C, std::void_t<decltype(C().push_front(value_type<C>()))>> = true;
0088 
0089 template<typename, typename = void>
0090 inline constexpr bool has_push_back_v = false;
0091 template<typename C>
0092 inline constexpr bool has_push_back_v<C, std::void_t<decltype(C().push_back(value_type<C>()))>> = true;
0093 
0094 template<typename, typename = void>
0095 inline constexpr bool has_insert_v = false;
0096 template<typename C>
0097 inline constexpr bool has_insert_v<C, std::void_t<decltype(C().insert(value_type<C>()))>> = true;
0098 
0099 template<typename, typename = void>
0100 inline constexpr bool has_pop_front_v = false;
0101 template<typename C>
0102 inline constexpr bool has_pop_front_v<C, std::void_t<decltype(C().pop_front())>> = true;
0103 
0104 template<typename, typename = void>
0105 inline constexpr bool has_pop_back_v = false;
0106 template<typename C>
0107 inline constexpr bool has_pop_back_v<C, std::void_t<decltype(C().pop_back())>> = true;
0108 
0109 template<typename, typename = void>
0110 inline constexpr bool has_iterator_v = false;
0111 template<typename C>
0112 inline constexpr bool has_iterator_v<C, std::void_t<iterator<C>>> = true;
0113 
0114 template<typename, typename = void>
0115 inline constexpr bool has_const_iterator_v = false;
0116 template<typename C>
0117 inline constexpr bool has_const_iterator_v<C, std::void_t<const_iterator<C>>> = true;
0118 
0119 template<typename, typename = void>
0120 inline constexpr bool can_set_value_at_iterator_v = false;
0121 template<typename C>
0122 inline constexpr bool can_set_value_at_iterator_v<C, std::void_t<decltype(*C().begin() = value_type<C>())>> = true;
0123 
0124 template<typename, typename = void>
0125 inline constexpr bool can_set_mapped_at_iterator_v = false;
0126 template<typename C>
0127 inline constexpr bool can_set_mapped_at_iterator_v<C, std::void_t<decltype(*C().begin() = mapped_type<C>())>> = true;
0128 
0129 template<typename, typename = void>
0130 inline constexpr bool can_insert_value_at_iterator_v = false;
0131 template<typename C>
0132 inline constexpr bool can_insert_value_at_iterator_v<C, std::void_t<decltype(C().insert(C().begin(), value_type<C>()))>> = true;
0133 
0134 template<typename, typename = void>
0135 inline constexpr bool can_erase_at_iterator_v = false;
0136 template<typename C>
0137 inline constexpr bool can_erase_at_iterator_v<C, std::void_t<decltype(C().erase(C().begin()))>> = true;
0138 
0139 template<typename, typename = void>
0140 inline constexpr bool can_erase_range_at_iterator_v = false;
0141 template<typename C>
0142 inline constexpr bool can_erase_range_at_iterator_v<C, std::void_t<decltype(C().erase(C().begin(), C().end()))>> = true;
0143 
0144 template<typename, typename = void>
0145 inline constexpr bool can_get_at_key_v = false;
0146 template<typename C>
0147 inline constexpr bool can_get_at_key_v<C, std::void_t<mapped_type<C>(decltype(C()[key_type<C>()]))>> = true;
0148 
0149 template<typename, typename = void>
0150 inline constexpr bool can_set_at_key_v = false;
0151 template<typename C>
0152 inline constexpr bool can_set_at_key_v<C, std::void_t<decltype(C()[key_type<C>()] = mapped_type<C>())>> = true;
0153 
0154 template<typename, typename = void>
0155 inline constexpr bool can_erase_at_key_v = false;
0156 template<typename C>
0157 inline constexpr bool can_erase_at_key_v<C, std::void_t<decltype(C().erase(key_type<C>()))>> = true;
0158 
0159 template<typename, typename = void>
0160 inline constexpr bool can_remove_at_key_v = false;
0161 template<typename C>
0162 inline constexpr bool can_remove_at_key_v<C, std::void_t<decltype(C().remove(key_type<C>()))>> = true;
0163 
0164 template<typename, typename = void>
0165 inline constexpr bool can_insert_key_v = false;
0166 template<typename C>
0167 inline constexpr bool can_insert_key_v<C, std::void_t<decltype(C().insert(key_type<C>()))>> = true;
0168 
0169 template<typename, typename = void>
0170 inline constexpr bool can_insert_pair_v = false;
0171 template<typename C>
0172 inline constexpr bool can_insert_pair_v<C, std::void_t<decltype(C().insert({key_type<C>(), mapped_type<C>()}))>> = true;
0173 
0174 template<typename, typename = void>
0175 inline constexpr bool can_insert_key_mapped_v = false;
0176 template<typename C>
0177 inline constexpr bool can_insert_key_mapped_v<C, std::void_t<decltype(C().insert(key_type<C>(), mapped_type<C>()))>> = true;
0178 
0179 template<typename, typename = void>
0180 inline constexpr bool has_contains_v = false;
0181 template<typename C>
0182 inline constexpr bool has_contains_v<C, std::void_t<decltype(bool(C().contains(key_type<C>())))>> = true;
0183 
0184 template<typename, typename = void>
0185 inline constexpr bool has_find_v = false;
0186 template<typename C>
0187 inline constexpr bool has_find_v<C, std::void_t<decltype(C().find(key_type<C>()))>> = true;
0188 
0189 template<typename, typename = void>
0190 inline constexpr bool iterator_dereferences_to_value_v = false;
0191 template<typename C>
0192 inline constexpr bool iterator_dereferences_to_value_v<C, std::void_t<decltype(value_type<C>(*C().begin()))>> = true;
0193 
0194 template<typename, typename = void>
0195 inline constexpr bool iterator_has_key_v = false;
0196 template<typename C>
0197 inline constexpr bool iterator_has_key_v<C, std::void_t<decltype(key_type<C>(C().begin().key()))>> = true;
0198 
0199 template<typename, typename = void>
0200 inline constexpr bool value_type_has_first_v = false;
0201 template<typename C>
0202 inline constexpr bool value_type_has_first_v<C, std::void_t<decltype(key_type<C>(value_type<C>().first))>> = true;
0203 
0204 template<typename, typename = void>
0205 inline constexpr bool iterator_dereferences_to_key_v = false;
0206 template<typename C>
0207 inline constexpr bool iterator_dereferences_to_key_v<C, std::void_t<decltype(key_type<C>(*C().begin()))>> = true;
0208 
0209 template<typename, typename = void>
0210 inline constexpr bool iterator_has_value_v = false;
0211 template<typename C>
0212 inline constexpr bool iterator_has_value_v<C, std::void_t<decltype(mapped_type<C>(C().begin().value()))>> = true;
0213 
0214 template<typename, typename = void>
0215 inline constexpr bool value_type_has_second_v = false;
0216 template<typename C>
0217 inline constexpr bool value_type_has_second_v<C, std::void_t<decltype(mapped_type<C>(value_type<C>().second))>> = true;
0218 
0219 template<typename, typename = void>
0220 inline constexpr bool iterator_dereferences_to_mapped_v = false;
0221 template<typename C>
0222 inline constexpr bool iterator_dereferences_to_mapped_v<C, std::void_t<decltype(mapped_type<C>(*C().begin()))>> = true;
0223 
0224 QT_WARNING_POP
0225 
0226 }
0227 
0228 QT_END_NAMESPACE
0229 
0230 #endif // QCONTAINERINFO_H