From 5f083f2b67578016d38bf2e12c70decf352917a7 Mon Sep 17 00:00:00 2001 From: q66 Date: Sat, 11 Jul 2015 19:54:51 +0100 Subject: [PATCH] better to_string test --- octa/string.hh | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/octa/string.hh b/octa/string.hh index 2aa849c..2b6b092 100644 --- a/octa/string.hh +++ b/octa/string.hh @@ -479,15 +479,16 @@ AnyString concat(std::initializer_list v, const S &sep = " ") { namespace detail { template - struct ToStringTest { - template struct Test {}; - template static char test(Test *); - template static int test(...); - static constexpr bool value = (sizeof(test(0)) == sizeof(char)); - }; + auto test_tostring(int) -> + decltype(IsSame().to_string()), String>()); + template + False test_tostring(...); template - static True test_iterable(decltype(octa::iter(declval())) *); + using ToStringTest = decltype(test_tostring(0)); + + template + True test_iterable(decltype(octa::iter(declval())) *); template static False test_iterable(...); template