From d1ce180fee7b660f989e22e8b91a2cf0f53ded6a Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 29 Apr 2017 16:05:57 +0200 Subject: compat/util: add macro for memoizing values --- compat/util.hpp | 2 ++ 1 file changed, 2 insertions(+) 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 using mem = std::shared_ptr; template using ptr = std::unique_ptr; -- cgit v1.2.3