|
Boost : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2022-02-18 16:36:44
Andrea Bocci wrote:
> Hi Andrey,
> now I'm curious... is
>
> alignas(int) unsigned char storage[sizeof(int)];
> int* p1 = new (storage) int(1);
> int* p3 = new (storage) int(3);
> std::printf("%d\n", *p1);
>
> different from
>
> int* p1 = new int(1);
> int* p3 = new (p1) int(3);
> std::printf("%d\n", *p1);
>
> or even
>
> int p1 = 1;
> int* p3 = new (&p1) int(3);
> std::printf("%d\n", p1);
>
> ?
I don't think there's any difference here.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk