Boost logo

Boost :

Subject: Re: [boost] Variant2 review
From: Robert Ramey (ramey_at_[hidden])
Date: 2019-04-08 21:12:21


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


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk