logoalt Hacker News

Panzerschrek • today at 7:52 AM • 2 replies • view on HN

Does std::polymorphic require passed types to be copyable?


Replies

aw1621107 • today at 8:03 AM

Looks like it depends on the specific operation(s) you want to perform [0]. For instance, constructing a std::polymorphic<T> from an object of type T or derived from T requires that that object is copy-constructible (among other requirements), but copy-assigning one std::polymorphic<T> to another only requires that T is complete.

[0]: https://eel.is/c++draft/polymorphic

➕ show 1 reply
MFHava • today at 10:07 AM

Yes, there is currently no move-only std::polymorphic, like there is a move-only std::indirect ...