summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2017-04-29 16:05:57 +0200
committerStanislaw Halik <sthalik@misaki.pl>2017-04-29 16:05:57 +0200
commitd1ce180fee7b660f989e22e8b91a2cf0f53ded6a (patch)
tree572d6e62ed53e4282d48d8d0618c64b693b39827
parentef7a777660034a142f24a5edc63d06f25d4d0562 (diff)
compat/util: add macro for memoizing values
-rw-r--r--compat/util.hpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/compat/util.hpp b/compat/util.hpp
index 3adebd5b..b904978b 100644
--- a/compat/util.hpp
+++ b/compat/util.hpp
@@ -15,6 +15,8 @@
#define once_only(...) progn(static bool once = false; if (!once) { once = true; __VA_ARGS__; })
+#define load_time_value(x) progn(static const auto _value132((x)); return _value132;)
+
template<typename t> using mem = std::shared_ptr<t>;
template<typename t> using ptr = std::unique_ptr<t>;