I have a class that connects to a USB device in the constructor. If the device isn't present or some other situation fails then the constructor throws an exception and the calling code deals with it.
Something akin to:
CDevice* pDevice = NULL;
try
{
pDevice = new CDevice();
}
and so on. I would like to replace this call with an auto_ptr
but am not clear how to trap the exception while maintaining the correct scope of the object.