Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

C++ constructors can't return error codes or Result. That's the two-stage initialization (constructor call + initialize() call) wvenable is talking about.

(Of course you could do the same thing as Rust and expose only a static creator function and hide the actual constructor.)



Yeah, most projects I worked on was doing the static creator before Rust showed up on the scene since it sidesteps a lot of these issues.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: