How to handle constructors that must acquire multiple resources in an exception safe manner
Is there a better way? YES C++11 delivers a new feature called delegating constructors which deals with this situation very gracefully. But it is a bit subtle. The problem with throwing exceptions in constructors is to realize that the destructor of the object you’re constructing doesn’t run until the constructor is complete. Though the destructors … Read more