From 6f07de81a6ca430c522527958e05440d67b04937 Mon Sep 17 00:00:00 2001 From: zaaarf Date: Sun, 7 Jan 2024 23:47:39 +0100 Subject: feat: condition loading and parsing Co-authored-by: Hop311 --- src/openvic-simulation/dataloader/NodeTools.hpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/openvic-simulation/dataloader/NodeTools.hpp') diff --git a/src/openvic-simulation/dataloader/NodeTools.hpp b/src/openvic-simulation/dataloader/NodeTools.hpp index 8ad731b..00ba02d 100644 --- a/src/openvic-simulation/dataloader/NodeTools.hpp +++ b/src/openvic-simulation/dataloader/NodeTools.hpp @@ -21,9 +21,12 @@ namespace OpenVic { * searched for without needing to be copied into a string */ template, class KeyEqual = std::equal_to<>> using string_map_t = ordered_map; + template + using case_insensitive_string_map_t = string_map_t; /* String set type supporting heterogeneous key lookup */ using string_set_t = ordered_set; + using case_insensitive_string_set_t = case_insensitive_ordered_set; namespace NodeTools { @@ -247,10 +250,12 @@ namespace OpenVic { node_callback_t name_list_callback(callback_t&&> callback); - template - Callback auto expect_mapped_string(string_map_t const& map, Callback auto callback) { + template + Callback auto expect_mapped_string( + string_map_t const& map, Callback auto callback + ) { return [&map, callback](std::string_view string) -> bool { - const typename string_map_t::const_iterator it = map.find(string); + const typename string_map_t::const_iterator it = map.find(string); if (it != map.end()) { return callback(it->second); } -- cgit v1.2.3-56-ga3b1