27 Input/output library [input.output]

27.2 Iostreams requirements [iostreams.requirements]

27.2.1 Imbue limitations [iostream.limits.imbue]

No function described in Clause [input.output] except for ios_base::imbue and basic_filebuf::pubimbue causes any instance of basic_ios::imbue or basic_streambuf::imbue to be called. If any user function called from a function declared in Clause [input.output] or as an overriding virtual function of any class declared in Clause [input.output] calls imbue, the behavior is undefined.

27.2.2 Positioning type limitations [iostreams.limits.pos]

The classes of Clause [input.output] with template arguments charT and traits behave as described if traits::pos_type and traits::off_type are streampos and streamoff respectively. Except as noted explicitly below, their behavior when traits::pos_type and traits::off_type are other types is implementation-defined.

In the classes of Clause [input.output], a template parameter with name charT represents a member of the set of types containing char, wchar_t, and any other implementation-defined character types that satisfy the requirements for a character on which any of the iostream components can be instantiated.

27.2.3 Thread safety [iostreams.threadsafety]

Concurrent access to a stream object ([string.streams], [file.streams]), stream buffer object ([stream.buffers]), or C Library stream ([c.files]) by multiple threads may result in a data race ([intro.multithread]) unless otherwise specified ([iostream.objects]). [ Note: Data races result in undefined behavior ([intro.multithread]).  — end note ]

If one thread makes a library call a that writes a value to a stream and, as a result, another thread reads this value from the stream through a library call b such that this does not result in a data race, then a's write synchronizes with b's read.