27 Input/output library [input.output]

27.5 Iostreams base classes [iostreams.base]

27.5.3 Class ios_base [ios.base]

27.5.3.6 ios_base callbacks [ios.base.callback]

void register_callback(event_callback fn, int index);

Effects: Registers the pair (fn, index) such that during calls to imbue() ([ios.base.locales]), copyfmt(), or ~ios_base() ([ios.base.cons]), the function fn is called with argument index. 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.

Requires: The function fn shall not throw exceptions.

Remarks: Identical pairs are not merged. A function registered twice will be called twice.