util: Make Assume() usable as unary expression

This commit is contained in:
MarcoFalke
2021-02-28 16:38:19 +01:00
parent d099894ec1
commit fa4cebadcf
2 changed files with 4 additions and 1 deletions

View File

@@ -69,7 +69,7 @@ T get_pure_r_value(T&& val)
#ifdef ABORT_ON_FAILED_ASSUME
#define Assume(val) Assert(val)
#else
#define Assume(val) ((void)(val))
#define Assume(val) ([&]() -> decltype(get_pure_r_value(val)) { auto&& check = (val); return std::forward<decltype(get_pure_r_value(val))>(check); }())
#endif
#endif // BITCOIN_UTIL_CHECK_H