aboutsummaryrefslogtreecommitdiff
path: root/include/cru/common/Format.hpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2022-01-18 23:25:48 +0800
committercrupest <crupest@outlook.com>2022-01-18 23:25:48 +0800
commiteecd4e5ba96244be15e3be9a9a4d404c36a533c7 (patch)
tree2715b7b3e6297853ebc3933b7302ec47aee99812 /include/cru/common/Format.hpp
parentbc37fdb4b746ce0f5f5c49ad9779464acb488284 (diff)
downloadcru-eecd4e5ba96244be15e3be9a9a4d404c36a533c7.tar.gz
cru-eecd4e5ba96244be15e3be9a9a4d404c36a533c7.tar.bz2
cru-eecd4e5ba96244be15e3be9a9a4d404c36a533c7.zip
...
Diffstat (limited to 'include/cru/common/Format.hpp')
-rw-r--r--include/cru/common/Format.hpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/include/cru/common/Format.hpp b/include/cru/common/Format.hpp
index d53a5720..c093c9e6 100644
--- a/include/cru/common/Format.hpp
+++ b/include/cru/common/Format.hpp
@@ -2,6 +2,7 @@
#include "Exception.hpp"
#include "String.hpp"
+#include "cru/common/Base.hpp"
namespace cru {
inline String ToString(bool value) {
@@ -32,16 +33,14 @@ std::enable_if_t<std::is_floating_point_v<T>, String> ToString(T value) {
return String(str.cbegin(), str.cend());
}
+inline String ToString(String value) { return value; }
+
template <typename T>
-std::enable_if_t<
- std::is_convertible_v<decltype(ToString(std::declval<const T&>)), String>,
- String>
-ToString(const T& value, StringView option) {
- return ToString(value);
+String ToString(T&& value, StringView option) {
+ CRU_UNUSED(option)
+ return ToString(std::forward<T>(value));
}
-inline String ToString(String value) { return value; }
-
namespace details {
enum class FormatTokenType { PlaceHolder, Text };
enum class FormatPlaceHolderType { None, Positioned, Named };