diff options
author | Hop311 <Hop3114@gmail.com> | 2024-07-19 00:26:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-19 00:26:16 +0200 |
commit | a673f89bb2705826b1c646365eab1775727372b7 (patch) | |
tree | 3f2a270b5b85f91a22289091084a30c105f10f4d /src/openvic-simulation/dataloader/NodeTools.hpp | |
parent | 93d095ba30747c7158882668577c854be7ea39a1 (diff) | |
parent | d236dcf30c001e540377184565f4d173ed56f76e (diff) |
Merge pull request #171 from OpenVicProject/optimize/string-interning
Optimize some string interning cases
Diffstat (limited to 'src/openvic-simulation/dataloader/NodeTools.hpp')
-rw-r--r-- | src/openvic-simulation/dataloader/NodeTools.hpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/openvic-simulation/dataloader/NodeTools.hpp b/src/openvic-simulation/dataloader/NodeTools.hpp index acf5a41..30cba65 100644 --- a/src/openvic-simulation/dataloader/NodeTools.hpp +++ b/src/openvic-simulation/dataloader/NodeTools.hpp @@ -5,6 +5,7 @@ #include <optional> #include <type_traits> +#include <openvic-dataloader/detail/SymbolIntern.hpp> #include <openvic-dataloader/v2script/AbstractSyntaxTree.hpp> #include <tsl/ordered_set.h> @@ -173,6 +174,10 @@ namespace OpenVic { node_callback_t expect_length(callback_t<size_t> callback); node_callback_t expect_key( + ovdl::symbol<char> key, node_callback_t callback, bool* key_found = nullptr, bool allow_duplicates = false + ); + + node_callback_t expect_key( std::string_view key, node_callback_t callback, bool* key_found = nullptr, bool allow_duplicates = false ); @@ -269,14 +274,10 @@ namespace OpenVic { return ret; } - template<StringMapCase Case> - constexpr bool add_key_map_entries(template_key_map_t<Case>& key_map) { + template<IsOrderedMap Map> + constexpr bool add_key_map_entries(Map&& key_map) { return true; } - template<StringMapCase Case> - constexpr bool add_key_map_entries(template_key_map_t<Case>&& key_map) { - return add_key_map_entries(key_map); - } template<IsOrderedMap Map, typename... Args> bool add_key_map_entries( |