Commit 2b34c206 authored by Ronan's avatar Ronan
Browse files

fix(StatixString): add a workaround to deal with int constructors (Windows)

parent c327a603
......@@ -111,13 +111,19 @@ namespace Private {
RawStaticString<N> raw;
private:
template<std::size_t... Index, typename Int = int, typename std::enable_if<Int(Value) >= 0, int>::type* = nullptr>
template<typename T>
static bool testInt (T n) {
// Do not use it directly in the two enable_if below. (MSVC 2015 bug.)
return n < 0;
}
template<std::size_t... Index, typename Int = int, typename std::enable_if<!testInt<Int>(Value), int>::type* = nullptr>
constexpr StaticIntStringHelper (const IndexSequence<Index...> &) :
raw{ char('0' + Value / pow10(N - Index - 2) % 10 )..., '\0' } {}
raw{ char('0' + Value / pow10(N - Index - 2) % 10)..., '\0' } {}
template<std::size_t... Index, typename Int = int, typename std::enable_if<Int(Value) < 0, int>::type* = nullptr>
template<std::size_t... Index, typename Int = int, typename std::enable_if<testInt<Int>(Value), int>::type* = nullptr>
constexpr StaticIntStringHelper (const IndexSequence<Index...> &) :
raw{ '-', char('0' + abs(Value) / pow10(N - Index - 3) % 10 )..., '\0' } {}
raw{ '-', char('0' + abs(Value) / pow10(N - Index - 3) % 10)..., '\0' } {}
};
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment