mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-05-07 05:43:05 +00:00
fix(StatixString): add a workaround to deal with int constructors (Windows)
This commit is contained in:
parent
c327a60318
commit
2b34c206bd
1 changed files with 11 additions and 5 deletions
|
|
@ -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>
|
||||
constexpr StaticIntStringHelper (const IndexSequence<Index...> &) :
|
||||
raw{ char('0' + Value / pow10(N - Index - 2) % 10 )..., '\0' } {}
|
||||
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<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' + Value / pow10(N - Index - 2) % 10)..., '\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' + abs(Value) / pow10(N - Index - 3) % 10)..., '\0' } {}
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue