From de7d12974ff196369d11ed93d59ffd84dec71465 Mon Sep 17 00:00:00 2001 From: PotatosFish Date: Tue, 10 Apr 2018 19:22:11 -0500 Subject: [PATCH 1/2] Added support for custom types with 'toString' function --- include/fmt/core.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/fmt/core.h b/include/fmt/core.h index 98c5316c..3f5e7307 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -629,12 +629,19 @@ inline typename std::enable_if< template inline typename std::enable_if< + !std::is_same::value && !convert_to_int::value && !std::is_convertible>::value && !std::is_convertible>::value, typed_value>::type make_value(const T &val) { return val; } +template +inline typename std::enable_if< + std::is_same::value, + typed_value>::type + make_value(const T& val) {return static_cast>(val.toString());} + template typed_value make_value(const named_arg &val) { From 876d092bfe0d14a1d3146ee540abc3011adc50d9 Mon Sep 17 00:00:00 2001 From: PotatosFish Date: Tue, 10 Apr 2018 22:20:40 -0500 Subject: [PATCH 2/2] there should be no compile errors --- include/fmt/core.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/fmt/core.h b/include/fmt/core.h index 3f5e7307..c711df70 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -629,7 +629,6 @@ inline typename std::enable_if< template inline typename std::enable_if< - !std::is_same::value && !convert_to_int::value && !std::is_convertible>::value && !std::is_convertible>::value, @@ -640,7 +639,7 @@ template inline typename std::enable_if< std::is_same::value, typed_value>::type - make_value(const T& val) {return static_cast>(val.toString());} + make_value(T& val) {return static_cast>(val.toString());} template typed_value