29 Input/output library [input.output]

29.5 Iostreams base classes [iostreams.base]

29.5.3 Class ios_­base [ios.base]

29.5.3.7 Callbacks [ios.base.callback]

void register_callback(event_callback fn, int idx);
Preconditions: The function fn does not throw exceptions.
Effects: Registers the pair (fn, idx) such that during calls to imbue() ([ios.base.locales]), copyfmt(), or ~ios_­base() ([ios.base.cons]), the function fn is called with argument idx.
Functions registered are called when an event occurs, in opposite order of registration.
Functions registered while a callback function is active are not called until the next event.
Remarks: Identical pairs are not merged.
A function registered twice will be called twice.