Date: Mon, 15 Apr 2024 11:05:12 +0300
On Fri, 12 Apr 2024 at 18:16, Thiago Macieira via Std-Proposals
<std-proposals_at_[hidden]> wrote:
> Still, we are talking about storing a polymorphic type inside of std::any and
> the general rule of thumb is that an object is EITHER polymorphic or copyable,
That's going to change once std::polymorphic is realized to be
available by a wide audience.
> not both. Storing an uncopyable object inside of std::any sounds just wrong. I
You can't even do that, std::any requires that the stored object is
CopyConstructible. And of course
it does - std::any is copyable, and it erases the element type, so
quite like std::function and std::copyable_function,
it must require that the element is copyable.
> don't think it supports storing immovable types at all, does it? So this alone
No, because those aren't CopyConstructible.
<std-proposals_at_[hidden]> wrote:
> Still, we are talking about storing a polymorphic type inside of std::any and
> the general rule of thumb is that an object is EITHER polymorphic or copyable,
That's going to change once std::polymorphic is realized to be
available by a wide audience.
> not both. Storing an uncopyable object inside of std::any sounds just wrong. I
You can't even do that, std::any requires that the stored object is
CopyConstructible. And of course
it does - std::any is copyable, and it erases the element type, so
quite like std::function and std::copyable_function,
it must require that the element is copyable.
> don't think it supports storing immovable types at all, does it? So this alone
No, because those aren't CopyConstructible.
Received on 2024-04-15 08:05:26