From bc6c047152ecff52fe97d74c87b236714f096558 Mon Sep 17 00:00:00 2001 From: Jonathan Goyvaerts Date: Wed, 17 Apr 2019 21:50:25 +0200 Subject: [PATCH] [Base] Add generic implementation for converting from string to T, and add specific implementation for string to bool --- src/xenia/base/string_util.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/xenia/base/string_util.h b/src/xenia/base/string_util.h index c65e3de57..38bb85028 100644 --- a/src/xenia/base/string_util.h +++ b/src/xenia/base/string_util.h @@ -85,7 +85,15 @@ inline std::string to_string(const __m128& value) { #endif template -inline T from_string(const char* value, bool force_hex = false); +inline T from_string(const char* value, bool force_hex = false) { + // Missing implementation for converting type T to string + throw; +} + +template <> +inline bool from_string(const char* value, bool force_hex) { + return std::strcmp(value, "true") == 0 || value[0] == '1'; +} template <> inline int32_t from_string(const char* value, bool force_hex) {