aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/Compat.h
diff options
context:
space:
mode:
authormitchell <unknown>2020-01-05 22:01:07 -0500
committermitchell <unknown>2020-01-05 22:01:07 -0500
commita7b57f9b5bb481c9b5b98dda13c0e9c44d26a237 (patch)
tree2cdcc4c9d826c3a42c47746eab16b6079e35dfbd /include/Compat.h
parentc7e5af4bc7c06eaa6bb000b3f0a4569e31c9f9a9 (diff)
downloadscintilla-mirror-a7b57f9b5bb481c9b5b98dda13c0e9c44d26a237.tar.gz
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().
Diffstat (limited to 'include/Compat.h')
-rw-r--r--include/Compat.h17
1 files changed, 15 insertions, 2 deletions
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 <cmath>
#include <cstddef>
#include <memory>
#include <type_traits>
@@ -13,6 +14,18 @@
namespace Sci {
+// std::round (not present on older MacOSX SDKs)
+template<class T>
+T round(T arg) {
+ return round(arg);
+}
+
+// std::lround (not present on older MacOSX SDKs)
+template<class T>
+long lround(T arg) {
+ return lround(arg);
+}
+
// std::make_unique
template<class T> struct _Unique_if {
typedef std::unique_ptr<T> _Single_object;
@@ -37,7 +50,7 @@ template<class T>
template<class T, class... Args>
typename _Unique_if<T>::_Known_bound
make_unique(Args&&...) = delete;
-
+
// std::size
template <typename T, size_t N>
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