Graznarak
Graznarak

Reputation: 3734

Catch std::bad_expected_access

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

Answers (1)

Ahmed AEK
Ahmed AEK

Reputation: 18090

All specializations of std::bad_expected_access inherit from std::bad_expected_access<void>.

Catch std::bad_expected_access<void>

Upvotes: 2

Related Questions