I have a template class with a custom exception:
MyClass<T>::MyException;
When using my class I only care whether the exception has been thrown so I can programmatically handle it. Therefore when I catch the exception, I don't bother to name it.
try {
MyClass<T>::MyMethod ();
} catch (typename MyClass<T>::MyException) {
//Act appropriately
}
I want to know if there is any difference when I add the reference operator, e.g.
} catch (typename MyClass::MyException &) {
In either case, I don't end up using the caught exception aside from identifying the type. Is there any tradeoff or performance hit for one vs. the other?