C++ Logo

liaison

Advanced search

Re: [wg14/wg21 liaison] [isocpp-sg21] Telecon to review P2388R1 Minimum Contract Support: either Ignore or Check_and_abort

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Thu, 23 Sep 2021 15:51:19 +0300
On Wed, 22 Sept 2021 at 22:41, Gašper Ažman via Liaison
<liaison_at_[hidden]> wrote:
> post(audit, new) [r=return, x, y] { // seems like lambda-like captures fit in
> {r % x == 0};
> {r % y == 0};
> }

Intriguing. This approach allows me to write postconditions for
parameters that aren't const.
The capture allows me to decide whether to capture the original value
or a reference to a possibly
changing value, and it allows me to perform init-capture shenanigans
to capture whichever transformation
of a move-only type, too, or a transformation of a non-deep-const type, too.

Received on 2021-09-23 07:51:32