|
8 | 8 | #include "openvic-simulation/utility/Concepts.hpp" |
9 | 9 | #include "openvic-simulation/utility/Getters.hpp" |
10 | 10 | #include "openvic-simulation/utility/Logger.hpp" |
11 | | -#include "openvic-simulation/utility/Concepts.hpp" |
12 | 11 |
|
13 | 12 | namespace OpenVic { |
14 | 13 | /* Callbacks for trying to add duplicate keys via UniqueKeyRegistry::add_item */ |
@@ -176,17 +175,6 @@ namespace OpenVic { |
176 | 175 | using StorageInfo = _StorageInfo<item_type>; |
177 | 176 | using internal_storage_index_type = typename StorageInfo::index_type; |
178 | 177 | using identifier_index_map_t = template_string_map_t<internal_storage_index_type, Case>; |
179 | | - |
180 | | - //helper to avoid error 'index_t': is not a member of external_value_type |
181 | | - template<typename EXTERNAL_VALUE_TYPE, typename = void> |
182 | | - struct get_index_t { |
183 | | - using type = std::size_t; |
184 | | - }; |
185 | | - |
186 | | - template<has_index EXTERNAL_VALUE_TYPE> |
187 | | - struct get_index_t<EXTERNAL_VALUE_TYPE, std::void_t<typename EXTERNAL_VALUE_TYPE::index_t>> { |
188 | | - using type = typename EXTERNAL_VALUE_TYPE::index_t; |
189 | | - }; |
190 | 178 |
|
191 | 179 | public: |
192 | 180 | using storage_type = typename StorageInfo::storage_type; |
@@ -372,10 +360,7 @@ namespace OpenVic { |
372 | 360 | return nullptr; \ |
373 | 361 | } \ |
374 | 362 | constexpr external_value_type CONST* get_item_by_index(const index_t typed_index) CONST { \ |
375 | | - std::size_t index; \ |
376 | | - if constexpr (std::is_same_v<index_t, std::size_t>) { \ |
377 | | - index = typed_index; \ |
378 | | - } else { index = type_safe::get(typed_index); } \ |
| 363 | + const std::size_t index = get_index_as_size_t(typed_index); \ |
379 | 364 | if (index < 0 || index >= items.size()) { \ |
380 | 365 | return nullptr; \ |
381 | 366 | } \ |
|
0 commit comments