From 46ced88c30eeb5f84b7fe78a36d18428babe4fcf Mon Sep 17 00:00:00 2001 From: crupest Date: Tue, 18 Jan 2022 23:27:37 +0800 Subject: ... --- include/cru/common/Format.hpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'include/cru/common/Format.hpp') diff --git a/include/cru/common/Format.hpp b/include/cru/common/Format.hpp index c093c9e6..c2fd2e09 100644 --- a/include/cru/common/Format.hpp +++ b/include/cru/common/Format.hpp @@ -33,14 +33,17 @@ std::enable_if_t, String> ToString(T value) { return String(str.cbegin(), str.cend()); } -inline String ToString(String value) { return value; } - template -String ToString(T&& value, StringView option) { +std::enable_if_t< + std::is_convertible_v)), String>, + String> +ToString(const T& value, StringView option) { CRU_UNUSED(option) - return ToString(std::forward(value)); + return ToString(value); } +inline String ToString(String value) { return value; } + namespace details { enum class FormatTokenType { PlaceHolder, Text }; enum class FormatPlaceHolderType { None, Positioned, Named }; -- cgit v1.2.3