top | item 45156729

(no title)

sgsjchs | 5 months ago

Reopen by constructing and assigning a new socket.

discuss

order

spacechild1|5 months ago

So I essentially have to wrap it in something like std::optional. Well, that's certainly one way to write a socket class, but I'd say it's not idiomatic C++. (I have never seen a socket class being implemented like that.)

sgsjchs|5 months ago

You don't need optional in this case, the assignment would just destroy the old socket and immediately move the new one in its place.