Reputation: 3734
std::bad_expected_access is a template class that is thrown. I have code that only cares that any instantiation of it is thrown, not which instantiation. Is there a way to catch (or some other mechanism) all instantiations of a template that are thrown?
Upvotes: 4
Views: 82
Reputation: 18090
All specializations of std::bad_expected_access inherit from std::bad_expected_access<void>
.
Catch std::bad_expected_access<void>
Upvotes: 2