logoalt Hacker News

MFHava • today at 10:16 AM • 1 reply • view on HN

Well, https://eel.is/c++draft/polymorphic#assign-2.2 requires copy-constructibility.


Replies

aw1621107 • today at 10:35 AM

Ah, you're right, that's a bad example. I had assumed that that kind of precondition would be explicitly mentioned so I didn't read the rest of the text as closely as I should have.

Perhaps move-assignment would have been a better example? That one at least mentions construction using an rvalue so I think that specific operation would work for move-only types.

Though now that I think about a bit more I suppose it's a bit of a moot point since the constructors all look like they require a copy-constructible T