Proposal: do_and_assert()
The following has become an all too common pattern for me:
bool result = DoSomething();
(void)result;
assert(result);
I want DoSomething()
to be evaluated, but I only want its return value to be checked in debug mode. I propose a function that does this automatically:
cm::do_and_assert(DoSomething());