Files
cppdraft_translate/cppdraft/ostream/inserters.md
2025-10-25 03:02:53 +03:00

4.9 KiB
Raw Blame History

[ostream.inserters]

31 Input/output library [input.output]

31.7 Formatting and manipulators [iostream.format]

31.7.6 Output streams [output.streams]

31.7.6.3 Formatted output functions [ostream.formatted]

31.7.6.3.3 basic_ostream::operator<< [ostream.inserters]

🔗

basic_ostream& operator<<(basic_ostream& (*pf)(basic_ostream&));

1

#

Effects: None.

Does not behave as a formatted output function (as described in [ostream.formatted.reqmts]).

2

#

Returns: pf(*this).286

🔗

basic_ostream& operator<<(basic_ios<charT, traits>& (*pf)(basic_ios<charT, traits>&));

3

#

Effects: Callspf(*this).

This inserter does not behave as a formatted output function (as described in [ostream.formatted.reqmts]).

4

#

Returns: *this.287

🔗

basic_ostream& operator<<(ios_base& (*pf)(ios_base&));

5

#

Effects: Callspf(*this).

This inserter does not behave as a formatted output function (as described in [ostream.formatted.reqmts]).

6

#

Returns: *this.

🔗

basic_ostream& operator<<(basic_streambuf<charT, traits>* sb);

7

#

Effects: Behaves as an unformatted output function ([ostream.unformatted]).

After the sentry object is constructed, ifsb is null callssetstate(badbit) (which may throwios_base::failure).

8

#

Gets characters from sb and inserts them in*this.

Characters are read from sb and inserted until any of the following occurs:

end-of-file occurs on the input sequence;

inserting in the output sequence fails (in which case the character to be inserted is not extracted);

an exception occurs while getting a character from sb.

9

#

If the function inserts no characters, it callssetstate(failbit) (which may throwios_base::failure ([iostate.flags])).

If an exception was thrown while extracting a character, the function setsfailbit in the error state, and iffailbit is set inexceptions() the caught exception is rethrown.

10

#

Returns: *this.

🔗

basic_ostream& operator<<(nullptr_t);

11

#

Effects: Equivalent to:return *this << s; where s is animplementation-definedNTCTS.

286)286)

See, for example, the function signatureendl(basic_ostream&) ([ostream.manip]).

287)287)

See, for example, the function signaturedec(ios_base&) ([basefield.manip]).