Date: Sat, 7 Oct 2023 16:25:59 +0300
> On 7 Oct 2023, at 16:10, Ville Voutilainen <ville.voutilainen_at_[hidden]> wrote:
> That's certainly a possible work-around, but it also always incurs the
> cost of the copy, even though
> you really need the copy only when the contract is checked.
What if the return type is non-copyable non-movable, such as a std::atomic? Not really an issue in C I guess, but definitely an issue in C++. This is one of the reasons why in C++, a fully-featured postcondition facility is impossible to implement with macros and requires a new language feature.
Cheers,
Timur
> That's certainly a possible work-around, but it also always incurs the
> cost of the copy, even though
> you really need the copy only when the contract is checked.
What if the return type is non-copyable non-movable, such as a std::atomic? Not really an issue in C I guess, but definitely an issue in C++. This is one of the reasons why in C++, a fully-featured postcondition facility is impossible to implement with macros and requires a new language feature.
Cheers,
Timur
Received on 2023-10-07 13:26:03