From 2b34c206bd66ba135341d74be926744f6654b40a Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Fri, 18 May 2018 18:02:22 +0200 Subject: [PATCH] fix(StatixString): add a workaround to deal with int constructors (Windows) --- include/linphone/utils/static-string.h | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/include/linphone/utils/static-string.h b/include/linphone/utils/static-string.h index ae65f6668..67b20884f 100644 --- a/include/linphone/utils/static-string.h +++ b/include/linphone/utils/static-string.h @@ -111,13 +111,19 @@ namespace Private { RawStaticString raw; private: - template= 0, int>::type* = nullptr> - constexpr StaticIntStringHelper (const IndexSequence &) : - raw{ char('0' + Value / pow10(N - Index - 2) % 10 )..., '\0' } {} + template + static bool testInt (T n) { + // Do not use it directly in the two enable_if below. (MSVC 2015 bug.) + return n < 0; + } - template::type* = nullptr> + template(Value), int>::type* = nullptr> constexpr StaticIntStringHelper (const IndexSequence &) : - raw{ '-', char('0' + abs(Value) / pow10(N - Index - 3) % 10 )..., '\0' } {} + raw{ char('0' + Value / pow10(N - Index - 2) % 10)..., '\0' } {} + + template(Value), int>::type* = nullptr> + constexpr StaticIntStringHelper (const IndexSequence &) : + raw{ '-', char('0' + abs(Value) / pow10(N - Index - 3) % 10)..., '\0' } {} }; };