summaryrefslogtreecommitdiffhomepage
path: root/compat
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2022-10-18 16:42:47 +0200
committerStanislaw Halik <sthalik@misaki.pl>2022-10-18 16:43:41 +0200
commita143f327642fc6af66e78db3ed533bd231a78ee0 (patch)
tree00be07d67ea92fd0cf28180b30c1c126249343a2 /compat
parent1dd9d41a1d41183c5bbbcdd6dcfbc0f9ae180173 (diff)
add size_t literal suffix polyfill
Diffstat (limited to 'compat')
-rw-r--r--compat/literal-size-type.hpp25
-rw-r--r--compat/prelude.hpp3
2 files changed, 28 insertions, 0 deletions
diff --git a/compat/literal-size-type.hpp b/compat/literal-size-type.hpp
new file mode 100644
index 00000000..1eef90d3
--- /dev/null
+++ b/compat/literal-size-type.hpp
@@ -0,0 +1,25 @@
+#pragma once
+#include <cstddef>
+
+namespace floormat {
+
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wuser-defined-literals"
+#elif defined _MSC_VER
+#pragma warning(push)
+#pragma warning(disable : 4455)
+#endif
+
+constexpr std::size_t operator"" z(unsigned long long int x) noexcept
+{
+ return std::size_t(x);
+}
+
+#ifdef __clang__
+#pragma clang diagnostic pop
+#elif defined _MSC_VER
+#pragma warning(pop)
+#endif
+
+} // namespace floormat
diff --git a/compat/prelude.hpp b/compat/prelude.hpp
index 077d5a75..1841e50b 100644
--- a/compat/prelude.hpp
+++ b/compat/prelude.hpp
@@ -1,4 +1,7 @@
#pragma once
+#if !(defined __cpp_size_t_suffix && __cpp_size_t_suffix >= 202006L)
+#include "literal-size-type.hpp"
+#endif
namespace Magnum {}
namespace floormat {