4 ms·
How is a factory function not idiomatic? It's not as if C++ is a single paradigm language that encourages a singular style or paradigm like OO. RAII is a mess
by qayxc 5y ago
How is a factory function not idiomatic? It's not as if C++ is a single paradigm language that encourages a singular style or paradigm like OO.
RAII is a mess in certain circumstances (looking at you, Vulkan API) and sometimes straight up just doesn't work anyway.
If your initialisation is prone to failure, don't do it in a ctor.