29 Input/output library [input.output]

29.2 Iostreams requirements [iostreams.requirements]

29.2.1 Imbue limitations [iostream.limits.imbue]

No function described in [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 [input.output] or as an overriding virtual function of any class declared in [input.output] calls imbue, the behavior is undefined.

29.2.2 Types [stream.types]

using streamoff = implementation-defined;
The type streamoff is a synonym for one of the signed basic integral types of sufficient size to represent the maximum possible file size for the operating system.275
using streamsize = implementation-defined;
The type streamsize is a synonym for one of the signed basic integral types.
It is used to represent the number of characters transferred in an I/O operation, or the size of I/O buffers.276
275)275)
Typically long long.
276)276)
Most places where streamsize is used would use size_­t in ISO C, or ssize_­t in POSIX.

29.2.3 Positioning type limitations [iostreams.limits.pos]

The classes of [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.
[Note 1:
For each of the specializations of char_­traits defined in [char.traits.specializations], state_­type denotes mbstate_­t, pos_­type denotes fpos<mbstate_­t>, and off_­type denotes streamoff.
— end note]
In the classes of [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 meet the requirements for a character on which any of the iostream components can be instantiated.

29.2.4 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 1:
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.