8 Apr
2019
8 Apr
'19
9:12 p.m.
On 4/8/19 1:42 PM, Niall Douglas via Boost wrote:
Something which I have found is surprisingly uncommon amongst even expert C++ programmers is the judicious use of static_assert to ensure no surprises down the line when junior programmers go modify something that they don't realise the consequences of.
In my own code, you'll find lots of stanzas like this:
``` #ifdef NDEBUG static_assert(sizeof(X) <= cmax(sizeof(A), sizeof(B), sizeof(C), ...));
static_assert(noexcept(std::declval<A>() = std::move(std::declval<A>())); #endif ```
... and so on.
Why do you bother with the #ifdef NDEBUG ? Robert Ramey