[ostream.general] # 31 Input/output library [[input.output]](./#input.output) ## 31.7 Formatting and manipulators [[iostream.format]](iostream.format#ostream.general) ### 31.7.6 Output streams [[output.streams]](output.streams#ostream.general) #### 31.7.6.2 Class template basic_ostream [[ostream]](ostream#general) #### 31.7.6.2.1 General [ostream.general] [1](#1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L5921) When a function has a parameter type *extended-floating-point-type*, the implementation provides overloads for all cv-unqualified extended floating-point types ([[basic.fundamental]](basic.fundamental "6.9.2 Fundamental types"))[.](#1.sentence-1) [🔗](#lib:basic_ostream) namespace std {template>class basic_ostream : virtual public basic_ios {public:// types (inherited from [basic_ios](ios "31.5.4 Class template basic_­ios [ios]"))using char_type = charT; using int_type = typename traits::int_type; using pos_type = typename traits::pos_type; using off_type = typename traits::off_type; using traits_type = traits; // [[ostream.cons]](ostream.cons "31.7.6.2.2 Constructors"), constructor/destructorexplicit basic_ostream(basic_streambuf* sb); virtual ~basic_ostream(); // [[ostream.sentry]](ostream.sentry "31.7.6.2.4 Class basic_­ostream​::​sentry"), prefix/suffixclass sentry; // [[ostream.formatted]](ostream.formatted "31.7.6.3 Formatted output functions"), formatted output basic_ostream& operator<<(basic_ostream& (*pf)(basic_ostream&)); basic_ostream& operator<<(basic_ios& (*pf)(basic_ios&)); basic_ostream& operator<<(ios_base& (*pf)(ios_base&)); basic_ostream& operator<<(bool n); basic_ostream& operator<<(short n); basic_ostream& operator<<(unsigned short n); basic_ostream& operator<<(int n); basic_ostream& operator<<(unsigned int n); basic_ostream& operator<<(long n); basic_ostream& operator<<(unsigned long n); basic_ostream& operator<<(long long n); basic_ostream& operator<<(unsigned long long n); basic_ostream& operator<<(float f); basic_ostream& operator<<(double f); basic_ostream& operator<<(long double f); basic_ostream& operator<<(*extended-floating-point-type* f); basic_ostream& operator<<(const void* p); basic_ostream& operator<<(const volatile void* p); basic_ostream& operator<<(nullptr_t); basic_ostream& operator<<(basic_streambuf* sb); // [[ostream.unformatted]](ostream.unformatted "31.7.6.4 Unformatted output functions"), unformatted output basic_ostream& put(char_type c); basic_ostream& write(const char_type* s, streamsize n); basic_ostream& flush(); // [[ostream.seeks]](ostream.seeks "31.7.6.2.5 Seek members"), seeks pos_type tellp(); basic_ostream& seekp(pos_type); basic_ostream& seekp(off_type, ios_base::seekdir); protected:// [[ostream.cons]](ostream.cons "31.7.6.2.2 Constructors"), copy/move constructor basic_ostream(const basic_ostream&) = delete; basic_ostream(basic_ostream&& rhs); // [[ostream.assign]](ostream.assign "31.7.6.2.3 Assignment and swap"), assignment and swap basic_ostream& operator=(const basic_ostream&) = delete; basic_ostream& operator=(basic_ostream&& rhs); void swap(basic_ostream& rhs); }; // [[ostream.inserters.character]](ostream.inserters.character "31.7.6.3.4 Character inserter function templates"), character inserterstemplate basic_ostream& operator<<(basic_ostream&, charT); template basic_ostream& operator<<(basic_ostream&, char); template basic_ostream& operator<<(basic_ostream&, char); template basic_ostream& operator<<(basic_ostream&, signed char); template basic_ostream& operator<<(basic_ostream&, unsigned char); template basic_ostream& operator<<(basic_ostream&, wchar_t) = delete; template basic_ostream& operator<<(basic_ostream&, char8_t) = delete; template basic_ostream& operator<<(basic_ostream&, char16_t) = delete; template basic_ostream& operator<<(basic_ostream&, char32_t) = delete; template basic_ostream&operator<<(basic_ostream&, char8_t) = delete; template basic_ostream&operator<<(basic_ostream&, char16_t) = delete; template basic_ostream&operator<<(basic_ostream&, char32_t) = delete; template basic_ostream& operator<<(basic_ostream&, const charT*); template basic_ostream& operator<<(basic_ostream&, const char*); template basic_ostream& operator<<(basic_ostream&, const char*); template basic_ostream& operator<<(basic_ostream&, const signed char*); template basic_ostream& operator<<(basic_ostream&, const unsigned char*); template basic_ostream&operator<<(basic_ostream&, const wchar_t*) = delete; template basic_ostream&operator<<(basic_ostream&, const char8_t*) = delete; template basic_ostream&operator<<(basic_ostream&, const char16_t*) = delete; template basic_ostream&operator<<(basic_ostream&, const char32_t*) = delete; template basic_ostream&operator<<(basic_ostream&, const char8_t*) = delete; template basic_ostream&operator<<(basic_ostream&, const char16_t*) = delete; template basic_ostream&operator<<(basic_ostream&, const char32_t*) = delete;} [2](#2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L6060) The class templatebasic_ostream defines a number of member function signatures that assist in formatting and writing output to output sequences controlled by a stream buffer[.](#2.sentence-1) [3](#3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L6067) Two groups of member function signatures share common properties: the[*formatted output functions*](#def:formatted_output_functions) (or[*inserters*](#def:inserters)) and the[*unformatted output functions.*](#def:unformatted_output_functions.) Both groups of output functions generate (or[*insert*](#def:insert)) output[*characters*](#def:characters) by actions equivalent to callingrdbuf()->sputc(int_type)[.](#3.sentence-1) They may use other public members ofbasic_ostream except that they shall not invoke any virtual members ofrdbuf() exceptoverflow(),xsputn(), andsync()[.](#3.sentence-2) [4](#4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L6091) If one of these called functions throws an exception, then unless explicitly noted otherwise the output function setsbadbit in the error state[.](#4.sentence-1) Ifbadbit is set inexceptions(), the output function rethrows the exception without completing its actions, otherwise it does not throw anything and proceeds as if the called function had returned a failure indication[.](#4.sentence-2) [5](#5) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L6105) [*Note [1](#note-1)*: The deleted overloads of operator<< prevent formatting characters as integers and strings as pointers[.](#5.sentence-1) — *end note*]