summaryrefslogtreecommitdiffhomepage
path: root/compat/util.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'compat/util.hpp')
-rw-r--r--compat/util.hpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/compat/util.hpp b/compat/util.hpp
index a63e245f..5b9e2c69 100644
--- a/compat/util.hpp
+++ b/compat/util.hpp
@@ -1,10 +1,15 @@
#pragma once
+#include "ndebug-guard.hpp"
+
#include "make-unique.hpp"
#include "run-in-thread.hpp"
#include <memory>
#include <cmath>
+#include <utility>
+
+#include <QSharedPointer>
#define progn(...) ([&]() { __VA_ARGS__ }())
template<typename t> using mem = std::shared_ptr<t>;
@@ -41,3 +46,11 @@ inline auto clamp(const t& val, const u& min, const w& max) -> decltype(val * mi
{
return ::util_detail::clamp_<decltype(val * min * max)>(val, min, max);
}
+
+template<typename t, typename... xs>
+auto qptr(xs... args)
+{
+ return QSharedPointer<t>(new t(std::forward<xs>(args)...));
+}
+
+template<typename t> using qshared = QSharedPointer<t>;