2 ms·
That's an option, but now you're using a factory method instead of a constructor. It's a valid choice, particularly if you want to go for exception-free style -
by TeMPOraL 5y ago
That's an option, but now you're using a factory method instead of a constructor. It's a valid choice, particularly if you want to go for exception-free style - but GP's main point was that throwing from a constructor is not only not a footgun, it's actually the correct practice if you're writing RAII style.