summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2017-08-14 11:29:55 +0700
committerMaxime Coste <mawww@kakoune.org>2017-08-14 11:29:55 +0700
commit6aa2388700fbad7942b96e9711b60abfa0bb7114 (patch)
treef828eb22a432ca26e5a58f8974921c322b512fc7
parent1b1239b25a0b3d6186d1de1f72837cc4a307e70d (diff)
Use decltype(auto) return type for some to_string functions
Remove explicit return type thats just duplicating the return expression.
-rw-r--r--src/string.hh5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/string.hh b/src/string.hh
index 606a9986..bb026869 100644
--- a/src/string.hh
+++ b/src/string.hh
@@ -399,8 +399,7 @@ InplaceString<23> to_string(float val);
InplaceString<7> to_string(Codepoint c);
template<typename RealType, typename ValueType>
-decltype(to_string(std::declval<ValueType>()))
-to_string(const StronglyTypedNumber<RealType, ValueType>& val)
+decltype(auto) to_string(const StronglyTypedNumber<RealType, ValueType>& val)
{
return to_string((ValueType)val);
}
@@ -411,7 +410,7 @@ namespace detail
template<typename T> constexpr bool is_string = std::is_convertible<T, StringView>::value;
template<typename T, class = std::enable_if_t<not is_string<T>>>
-auto format_param(const T& val) -> decltype(to_string(val)) { return to_string(val); }
+decltype(auto) format_param(const T& val) { return to_string(val); }
template<typename T, class = std::enable_if_t<is_string<T>>>
StringView format_param(const T& val) { return val; }