std::exception is a standard C++ class defined in the <exception> header. It serves as a base class for all exceptions. It provides a what() member function that returns a descriptive string about the exception.
Example code:
#include <iostream>
#include <exception>
int main() {
try {
throw std::runtime_error("Something went wrong!");
}
catch (const std::exception& e) {
std::cout << "Exception caught: " << e.what() << std::endl;
}
return 0;
}