An implementation is permitted to define ios_base::failure
as a synonym for a class with equivalent functionality
to class ios_base::failure shown in this subclause.
When ios_base::failure is a synonym for another type,
that type is required to provide a nested type failure
to emulate the injected-class-name.
— end note]
The class
failure
defines the base class
for the types of all objects thrown as exceptions,
by functions in the iostreams library,
to report errors detected during stream buffer operations.
Errors arising from the operating system would typically be reported as
system_category() errors with an error value of the error number
reported by the operating system.
Errors arising from within the stream library would
typically be reported as error_code(io_errc::stream,
iostream_category()).