From fe37c89109b603d2678ca7817b5f819453280a4c Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Wed, 16 Aug 2023 21:35:13 -0700 Subject: [PATCH] FEXCore/Config: Stop making temporary string copies For config values that were string objects we were unnecessary creating copies each time the string was accessed. Convert the () operator over to returning a reference. --- External/FEXCore/include/FEXCore/Config/Config.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/External/FEXCore/include/FEXCore/Config/Config.h b/External/FEXCore/include/FEXCore/Config/Config.h index a1bb9dd10..a68e2ea2a 100644 --- a/External/FEXCore/include/FEXCore/Config/Config.h +++ b/External/FEXCore/include/FEXCore/Config/Config.h @@ -286,7 +286,13 @@ namespace Type { } operator T() const { return ValueData; } + + template requires (!std::is_same_v) T operator()() const { return ValueData; } + + template requires (std::is_same_v) + const T& operator()() const { return ValueData; } + Value(T Value) { ValueData = std::move(Value); } fextl::list &All() { return AppendList; }