From a7b57f9b5bb481c9b5b98dda13c0e9c44d26a237 Mon Sep 17 00:00:00 2001 From: mitchell Date: Sun, 5 Jan 2020 22:01:07 -0500 Subject: Added Sci::round() and Sci::lround() for better compatibility with the default branch. Some olders MacOSX SDKs do not have std::round() or std::lround(). --- include/Compat.h | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/Compat.h b/include/Compat.h index 712ff1373..d69a9a2c1 100644 --- a/include/Compat.h +++ b/include/Compat.h @@ -6,6 +6,7 @@ #ifdef __cplusplus +#include #include #include #include @@ -13,6 +14,18 @@ namespace Sci { +// std::round (not present on older MacOSX SDKs) +template +T round(T arg) { + return round(arg); +} + +// std::lround (not present on older MacOSX SDKs) +template +long lround(T arg) { + return lround(arg); +} + // std::make_unique template struct _Unique_if { typedef std::unique_ptr _Single_object; @@ -37,7 +50,7 @@ template template typename _Unique_if::_Known_bound make_unique(Args&&...) = delete; - + // std::size template constexpr size_t size(const T (&)[N]) noexcept { @@ -48,4 +61,4 @@ constexpr size_t size(const T (&)[N]) noexcept { #endif -#endif \ No newline at end of file +#endif -- cgit v1.2.3