News for hackers. Stuff that matters.
Re:What =delete means by ginko on Monday October 18, 2021 @11:56AM (#28906878)
In my company we do so by disallowing constructors to fail. If an object needs to be initialized with the potential of failure you need to call an init() function that returns an error code after construction.

Yes, that makes RAII basically impossible.

Re:What =delete means by ahartmetz on Monday October 18, 2021 @12:39PM (#28907487)
IMO the most important part of RAII is really the other side, "destruction is resource divestment" - and that still works. That is the main purpose of lock guards, refcounting wrappers, file objects and so on.
Re:What =delete means by kllrnohj on Monday October 18, 2021 @05:35PM (#28912088)
Why not a factory function that returns std::optional<T> instead? Or better a variant of T or error code?

The construct-then-init pattern is so annoying to deal with.