From e443fd79fda075f6b4db965f1f01e3bc9d8ba104 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Wed, 6 Jan 2016 01:48:34 +0100 Subject: [PATCH] type-traits(#985): better solution to detect string-like types we need this to branch into lexical conversion, which should always take precedence over a string conversion. The existing solution overlooked both the conversion paths for char*, as well as the fact that chars and c-strings can be handled directly (pass-through) by lexical conversion --- research/try.cpp | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/research/try.cpp b/research/try.cpp index 643d3a728..1a3dbefc4 100644 --- a/research/try.cpp +++ b/research/try.cpp @@ -112,21 +112,30 @@ stringz (P ptr) namespace { using lib::meta::Strip; - using std::__or_; - using std::__and_; + using std::is_convertible; + using std::is_arithmetic; + using std::is_same; using std::__not_; + using std::__and_; + using std::__or_; template struct is_basically - : std::is_same ::TypeReferred - ,typename Strip::TypeReferred> + : is_same ::TypeReferred + ,typename Strip::TypeReferred> + { }; + + template + struct is_StringLike + : __or_< is_basically + , is_convertible + > { }; template struct can_lexical2string - : __or_< std::is_arithmetic - , is_basically - , is_basically::type, char> + : __or_< is_arithmetic + , is_StringLike > { }; }