From 2b468a24cb285ce847056ca2c40bc51e1224bf8b Mon Sep 17 00:00:00 2001 From: Diavolo Date: Fri, 26 May 2023 16:20:43 +0200 Subject: [PATCH] maint(info_string): small fix --- premake5.lua | 4 ++-- src/std_include.hpp | 2 ++ src/utils/info_string.cpp | 15 ++++++++------- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/premake5.lua b/premake5.lua index 662f9f5..ae54d32 100644 --- a/premake5.lua +++ b/premake5.lua @@ -58,11 +58,11 @@ filter {} filter {"language:C++", "toolset:not msc*"} buildoptions { - "-std=c++17" + "-std=c++20" } filter "toolset:msc*" buildoptions { - "/std:c++17" + "/std:c++20" } filter {} diff --git a/src/std_include.hpp b/src/std_include.hpp index e610487..5245c23 100644 --- a/src/std_include.hpp +++ b/src/std_include.hpp @@ -31,10 +31,12 @@ #endif #include +#include #include #include #include #include +#include #include #include diff --git a/src/utils/info_string.cpp b/src/utils/info_string.cpp index 7f373f2..4d37ba1 100644 --- a/src/utils/info_string.cpp +++ b/src/utils/info_string.cpp @@ -43,23 +43,24 @@ namespace utils { const auto& key = key_values[i]; const auto& value = key_values[i + 1]; - this->key_value_pairs_[key] = value; + + if (!this->key_value_pairs_.contains(key)) + { + this->key_value_pairs_[key] = value; + } } } std::string info_string::build() const { - //auto first = true; std::string info_string; - for (auto i = this->key_value_pairs_.begin(); i != this->key_value_pairs_.end(); ++i) + for (const auto& [key, val] : this->key_value_pairs_) { - //if (first) first = false; - /*else*/ info_string.append("\\"); - info_string.append(i->first); // Key + info_string.append(key); info_string.append("\\"); - info_string.append(i->second); // Value + info_string.append(val); } return info_string;