mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-09-13 18:13:42 +02:00
util: Allow Assert(...) to be used in all contexts
Fixes the compile error when used inside operator[]: ./chain.h:404:23: error: C++11 only allows consecutive left square brackets when introducing an attribute return (*this)[Assert(pindex)->nHeight] == pindex; ^
This commit is contained in:
committed by
MarcoFalke
parent
cb89e18845
commit
fa861569dc
@@ -54,6 +54,6 @@ T get_pure_r_value(T&& val)
|
||||
}
|
||||
|
||||
/** Identity function. Abort if the value compares equal to zero */
|
||||
#define Assert(val) [&]() -> decltype(get_pure_r_value(val)) { auto&& check = (val); assert(#val && check); return std::forward<decltype(get_pure_r_value(val))>(check); }()
|
||||
#define Assert(val) ([&]() -> decltype(get_pure_r_value(val)) { auto&& check = (val); assert(#val && check); return std::forward<decltype(get_pure_r_value(val))>(check); }())
|
||||
|
||||
#endif // BITCOIN_UTIL_CHECK_H
|
||||
|
Reference in New Issue
Block a user