C++ Logo


Advanced search

Re: [std-proposals] Relocation in C++

From: Edward Catmur <ecatmur_at_[hidden]>
Date: Tue, 3 May 2022 08:13:44 +0100
On Mon, 2 May 2022, 20:44 Edward Catmur, <ecatmur_at_[hidden]> wrote:

> On Mon, 2 May 2022 at 20:31, Thiago Macieira via Std-Proposals <
> std-proposals_at_[hidden]> wrote:
>> On Monday, 2 May 2022 12:14:42 PDT Edward Catmur wrote:
>> > > Unless you add a new type of reference, which we don't want.
>> >
>> > An attribute, perhaps. [[no_unique_address]] is precedent for attributes
>> > affecting ABI.
>> That is not a good precedent to copy. That should never have been an
>> attribute.
> Also it wouldn't pass Timur's ignorability test (as per P2552R0). So some
> other mark on the parameter would be necessary.

And further, it would leak into function pointer types. So that's a non

Library to the rescue: we can't have relocatable function parameters, so
use std::optional. Then all we need is a constructor of optional taking a
relocatable parameter, which is much less intrusive on the rest of the
language since you can't form a function pointer to a constructor.

Received on 2022-05-03 07:13:58