Should I inherit from std::exception?

The main benefit is that code using your classes doesn’t have to know exact type of what you throw at it, but can just catch the std::exception.

Edit: as Martin and others noted, you actually want to derive from one of the sub-classes of std::exception declared in <stdexcept> header.

Leave a Comment