summaryrefslogtreecommitdiffhomepage
path: root/compat/util.hpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2017-03-30 12:53:26 +0200
committerStanislaw Halik <sthalik@misaki.pl>2017-03-30 12:53:26 +0200
commitc3459749ce67e04757dac1f8e91af8203bacbe8f (patch)
treef7f04af56d72a4b47a6c7de2e277da0aff318030 /compat/util.hpp
parentab48cb1a088726130e814cbddc568c399fb5dc10 (diff)
compat/util: add macro for warning once
Diffstat (limited to 'compat/util.hpp')
-rw-r--r--compat/util.hpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/compat/util.hpp b/compat/util.hpp
index 9439271f..ee462d0e 100644
--- a/compat/util.hpp
+++ b/compat/util.hpp
@@ -11,6 +11,9 @@
#include <QDebug>
#define progn(...) ([&]() { __VA_ARGS__ }())
+
+#define once_only(...) progn(static bool once = false; if (!once) { once = true; __VA_ARGS__; })
+
template<typename t> using mem = std::shared_ptr<t>;
template<typename t> using ptr = std::unique_ptr<t>;