admin管理员组

文章数量:1287775

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?

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?

Share Improve this question asked Feb 23 at 7:13 GraznarakGraznarak 3,7424 gold badges31 silver badges50 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 2

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

Catch std::bad_expected_access<void>

本文标签: cCatch stdbadexpectedaccessStack Overflow