C++ Logo

std-proposals

Advanced search

Re: [std-proposals] An issue with IOC

From: blacktea hamburger <greenteahamburger_at_[hidden]>
Date: Mon, 3 Oct 2022 20:08:53 +0800
On Sun, Oct 2, 2022 at 11:23 PM Jason McKesson via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> On Sun, Oct 2, 2022 at 10:37 AM blacktea hamburger via Std-Proposals
> <std-proposals_at_[hidden]> wrote:
> >
> > However, the implicitly created object does end the lifetime of the
> original char objects. Although it can be accessed by char, the result of
> the access is no longer the original char objects' value (it's also not
> accessed by char).
> >
> > No copies are made in the code, which requires std::bit_cast or
> std::start_lifetime_as, which makes a change instead of a copy.
>
> Oh, and it's important to remember [intro.object]/3: When you create
> an object in a byte array (though it requires `unsigned char` or
> `std::byte`, so the P0593 example used the wrong type)
>

That's CWG2489 <https://wg21.link/CWG2489>.

Thank you for your explanation!

Received on 2022-10-03 12:09:23