[core] Polyfill std::chrono::abs
This commit is contained in:
@@ -53,6 +53,14 @@ std::string iso8601(SystemTimePoint);
|
||||
|
||||
SystemTimePoint parseTimePoint(const char *);
|
||||
|
||||
// C++17 polyfill
|
||||
template <class Rep, class Period, class = std::enable_if_t<
|
||||
std::chrono::duration<Rep, Period>::min() < std::chrono::duration<Rep, Period>::zero()>>
|
||||
constexpr std::chrono::duration<Rep, Period> abs(std::chrono::duration<Rep, Period> d)
|
||||
{
|
||||
return d >= d.zero() ? d : -d;
|
||||
}
|
||||
|
||||
} // namespace util
|
||||
|
||||
} // namespace mbgl
|
||||
|
||||
Reference in New Issue
Block a user