C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Copy-construct, move-construct, and PR-construct

From: Marcin Jaczewski <marcinjaczewski86_at_[hidden]>
Date: Mon, 21 Aug 2023 19:15:09 +0200
pon., 21 sie 2023 o 18:27 Sebastian Wittmeier via Std-Proposals
<std-proposals_at_[hidden]> napisał(a):
>
> I would prefer:
>
> F temp = t;
>
> or
>
> F temp = static_cast<F>(t);
>
> over the function-style cast, even if there is no copy constructor.
>
>

You may have miss a mark, my goal was to simulate emplace,
and it can't use `= t` or `static_cast`.
And as far I know it will use some thing like:
```
template<typename... T>
void emplace(T... t)
{
    alignas(F) unsigned char buf[sizeof(F)];

    F* tptr = new(buf) F(t...);
}
```
And my "hack" could work out of the box with current std classes.

>
> -----Ursprüngliche Nachricht-----
> F(const F&) = delete;
>
> F temp = F(t); //no copy there
>
>
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

Received on 2023-08-21 17:15:18