Nothrow functions
Sean Kelly
sean at invisibleduck.org
Thu Oct 2 10:43:55 PDT 2008
Janderson wrote:
>
> What if the object creates a handle to a resource in the constructor
> just before the exception. That resource never gets cleaned up unless
> your explicitly handle it with a try-catch. Other then the out of
> memory one, I'm not aware of any C++ standard library that throw in the
> constructor.
Yup, which is why it's possible to wrap the class member initializer
block in a try/catch if you want to. The language was clearly designed
to support exception use in ctors.
Sean
More information about the Digitalmars-d
mailing list