aboutsummaryrefslogtreecommitdiff
path: root/src/dolphin/Compat.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/dolphin/Compat.h')
-rw-r--r--src/dolphin/Compat.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/dolphin/Compat.h b/src/dolphin/Compat.h
index f2f52a5..787d505 100644
--- a/src/dolphin/Compat.h
+++ b/src/dolphin/Compat.h
@@ -61,3 +61,15 @@
{ \
printf(fmt "\n", ## __VA_ARGS__); \
} while (false)
+
+#if __cplusplus < 201703L
+// cheat
+namespace std
+{
+template <typename T>
+T clamp(const T& v, const T& lo, const T& hi)
+{
+ return v < lo ? lo : (v > hi ? hi : v);
+}
+}
+#endif \ No newline at end of file