This sort of works for me, and boost can make it even a bit more versatile. However, I doubt you'd be able to make a function for any case where exceptions would be handled:



#include...