Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/header/iosfwd"

From cppreference.com
< cpp‎ | header
(Forward declarations: std::basic_iostream is defined in the header <istream>, also + typedefs (see the synopsis))
(move synopsis to template)
 
(10 intermediate revisions by 5 users not shown)
Line 9: Line 9:
 
{{dsc| {{c|std::char_traits<char>}} | {{mark ptclass}} }}
 
{{dsc| {{c|std::char_traits<char>}} | {{mark ptclass}} }}
 
{{dsc| {{c|std::char_traits<wchar_t>}} | {{mark ptclass}} }}
 
{{dsc| {{c|std::char_traits<wchar_t>}} | {{mark ptclass}} }}
 +
{{dsc| {{c|std::char_traits<char8_t>}} {{mark c++20}} | {{mark ptclass}} }}
 
{{dsc| {{c|std::char_traits<char16_t>}} {{mark c++11}} | {{mark ptclass}} }}
 
{{dsc| {{c|std::char_traits<char16_t>}} {{mark c++11}} | {{mark ptclass}} }}
 
{{dsc| {{c|std::char_traits<char32_t>}} {{mark c++11}} | {{mark ptclass}} }}
 
{{dsc| {{c|std::char_traits<char32_t>}} {{mark c++11}} | {{mark ptclass}} }}
Line 16: Line 17:
  
 
{{dsc header | ios}}
 
{{dsc header | ios}}
{{dsc tclass | cpp/io/basic_ios | manages an arbitrary stream buffer}}
+
{{dsc inc | cpp/io/dsc basic_ios}}
{{dsc tclass | cpp/io/fpos | represents absolute position in a stream or a file}}
+
{{dsc inc | cpp/io/dsc fpos}}
  
 
{{dsc header | streambuf}}
 
{{dsc header | streambuf}}
{{dsc tclass | cpp/io/basic_streambuf | abstracts a raw device}}
+
{{dsc inc | cpp/io/dsc basic_streambuf}}
  
 
{{dsc header | ostream}}
 
{{dsc header | ostream}}
{{dsc tclass | cpp/io/basic_ostream | wraps a given abstract device ({{lc|std::basic_streambuf}})<br/> and provides high-level output interface}}
+
{{dsc inc | cpp/io/dsc basic_ostream}}
  
 
{{dsc header | istream}}
 
{{dsc header | istream}}
{{dsc tclass | cpp/io/basic_istream | wraps a given abstract device ({{lc|std::basic_streambuf}})<br/> and provides high-level input interface}}
+
{{dsc inc | cpp/io/dsc basic_istream}}
{{dsc tclass | cpp/io/basic_iostream | wraps a given abstract device ({{lc|std::basic_streambuf}})<br/> and provides high-level input/output interface}}
+
{{dsc inc | cpp/io/dsc basic_iostream}}
  
 
{{dsc header | fstream}}
 
{{dsc header | fstream}}
{{dsc tclass | cpp/io/basic_filebuf | implements raw file device}}
+
{{dsc inc | cpp/io/dsc basic_filebuf}}
{{dsc tclass | cpp/io/basic_ifstream | implements high-level file stream input operations}}
+
{{dsc inc | cpp/io/dsc basic_ifstream}}
{{dsc tclass | cpp/io/basic_ofstream | implements high-level file stream output operations}}
+
{{dsc inc | cpp/io/dsc basic_ofstream}}
{{dsc tclass | cpp/io/basic_fstream | implements high-level file stream input/output operations}}
+
{{dsc inc | cpp/io/dsc basic_fstream}}
  
 
{{dsc header | sstream}}
 
{{dsc header | sstream}}
{{dsc tclass | cpp/io/basic_stringbuf | implements raw string device}}
+
{{dsc inc | cpp/io/dsc basic_stringbuf}}
{{dsc tclass | cpp/io/basic_istringstream | implements high-level string stream input operations}}
+
{{dsc inc | cpp/io/dsc basic_istringstream}}
{{dsc tclass | cpp/io/basic_ostringstream | implements high-level string stream output operations}}
+
{{dsc inc | cpp/io/dsc basic_ostringstream}}
{{dsc tclass | cpp/io/basic_stringstream | implements high-level string stream input/output operations}}
+
{{dsc inc | cpp/io/dsc basic_stringstream}}
 +
 
 +
{{dsc header | syncstream}}
 +
{{dsc inc | cpp/io/dsc basic_syncbuf}}
 +
{{dsc inc | cpp/io/dsc basic_osyncstream}}
 +
 
 +
{{dsc header | spanstream}}
 +
{{dsc inc | cpp/io/dsc basic_spanbuf}}
 +
{{dsc inc | cpp/io/dsc basic_ispanstream}}
 +
{{dsc inc | cpp/io/dsc basic_ospanstream}}
 +
{{dsc inc | cpp/io/dsc basic_spanstream}}
  
 
{{dsc header | strstream}}
 
{{dsc header | strstream}}
{{dsc class | cpp/io/strstreambuf | notes={{mark deprecated}} | implements raw character array device}}
+
{{dsc inc | cpp/io/dsc strstreambuf}}
{{dsc class | cpp/io/istrstream | notes={{mark deprecated}} | implements character array input operations}}
+
{{dsc inc | cpp/io/dsc istrstream}}
{{dsc class | cpp/io/ostrstream | notes={{mark deprecated}} | implements character array output operations}}
+
{{dsc inc | cpp/io/dsc ostrstream}}
{{dsc class | cpp/io/strstream | notes={{mark deprecated}} | implements character array input/output operations}}
+
{{dsc inc | cpp/io/dsc strstream}}
  
 
{{dsc h1|Typedefs and specializations}}
 
{{dsc h1|Typedefs and specializations}}
{{dsc | {{lc|std::ios}} | {{c|basic_ios<char>}}}}   
+
{{dsc | {{lc|std::streampos}} | {{c|std::fpos<std::char_traits<char>::state_type>}}}}
{{dsc | {{lc|std::wios}} | {{c|basic_ios<wchar_t>}}}} 
+
{{dsc | {{lc|std::wstreampos}} | {{c|std::fpos<std::char_traits<wchar_t>::state_type>}}}}
+
{{dsc | {{lc|std::u8streampos}} | {{c|std::fpos<std::char_traits<char8_t>::state_type>}}}}
{{dsc | {{lc|std::streambuf}} | {{c|basic_streambuf<char>}}}}
+
{{dsc | {{lc|std::u16streampos}} | {{c|std::fpos<std::char_traits<char16_t>::state_type>}}}}
{{dsc | {{lc|std::istream}} | {{c|basic_istream<char>}}}}
+
{{dsc | {{lc|std::u32streampos}} | {{c|std::fpos<std::char_traits<char32_t>::state_type>}}}}
{{dsc | {{lc|std::ostream}} | {{c|basic_ostream<char>}}}}
+
{{dsc | In addition, for each class template {{tt|std::basic_''T''}} declared in this header, {{tt|std::''T''}} and {{tt|std::w''T''}} are declared as a synonym of {{tt|std::basic_''T''<char>}} and {{tt|std::basic_''T''<wchar_t>}} respectively.}}<!--It will be a rather long list if all of them are shown, see http://en.cppreference.com/w/?oldid=72068 and the header synopsis below-->
{{dsc | {{lc|std::iostream}} | {{c|basic_iostream<char>}}}}
+
+
{{dsc | {{lc|std::stringbuf}} | {{c|basic_stringbuf<char>}}}}
+
{{dsc | {{lc|std::istringstream}} | {{c|basic_istringstream<char>}}}}
+
{{dsc | {{lc|std::ostringstream}} | {{c|basic_ostringstream<char>}}}}
+
{{dsc | {{lc|std::stringstream}} | {{c|basic_stringstream<char>}}}}
+
+
{{dsc | {{lc|std::filebuf}} | {{c|basic_filebuf<char>}}}}
+
{{dsc | {{lc|std::ifstream}} | {{c|basic_ifstream<char>}}}}
+
{{dsc | {{lc|std::ofstream}} | {{c|basic_ofstream<char>}}}}
+
{{dsc | {{lc|std::fstream}} | {{c|basic_fstream<char>}}}}
+
+
{{dsc | {{lc|std::wstreambuf}} | {{c|basic_streambuf<wchar_t>}}}}
+
{{dsc | {{lc|std::wistream}} | {{c|basic_istream<wchar_t>}}}}
+
{{dsc | {{lc|std::wostream}} | {{c|basic_ostream<wchar_t>}}}}
+
{{dsc | {{lc|std::wiostream}} | {{c|basic_iostream<wchar_t>}}}}
+
+
{{dsc | {{lc|std::wstringbuf}} | {{c|basic_stringbuf<wchar_t>}}}}
+
{{dsc | {{lc|std::wistringstream}} | {{c|basic_istringstream<wchar_t>}}}}
+
{{dsc | {{lc|std::wostringstream}} | {{c|basic_ostringstream<wchar_t>}}}}
+
{{dsc | {{lc|std::wstringstream}} | {{c|basic_stringstream<wchar_t>}}}}
+
+
{{dsc | {{lc|std::wfilebuf}} | {{c|basic_filebuf<wchar_t>}}}}       
+
{{dsc | {{lc|std::wifstream}} | {{c|basic_ifstream<wchar_t>}}}}     
+
{{dsc | {{lc|std::wofstream}} | {{c|basic_ofstream<wchar_t>}}}}    
+
{{dsc | {{lc|std::wfstream}} | {{c|basic_fstream<wchar_t>}}}} 
+
+
{{dsc | {{lc|std::streampos}} | {{c|fpos<char_traits<char>::state_type>}}}}
+
{{dsc | {{lc|std::wstreampos}} | {{c|fpos<char_traits<wchar_t>::state_type>}}}}
+
{{dsc todo|probably need to replace this long list with a short profile}}
+
 
{{dsc end}}
 
{{dsc end}}
  
 
===Synopsis===
 
===Synopsis===
{{source|
+
{{cpp/synopsis/iosfwd}}
namespace std {
+
   
+
    template<class charT> class char_traits;
+
    template<> class char_traits<char>;
+
    template<> class char_traits<char16_t>;
+
    template<> class char_traits<char32_t>;
+
    template<> class char_traits<wchar_t>;
+
   
+
    template<class T> class allocator;
+
   
+
    template <class charT, class traits {{=}} char_traits<charT> >
+
        class basic_ios;
+
 
+
    template <class charT, class traits {{=}} char_traits<charT> >
+
        class basic_streambuf;
+
    template <class charT, class traits {{=}} char_traits<charT> >
+
        class basic_istream;
+
    template <class charT, class traits {{=}} char_traits<charT> >
+
        class basic_ostream;
+
    template <class charT, class traits {{=}} char_traits<charT> >
+
        class basic_iostream;
+
    template <class charT, class traits {{=}} char_traits<charT>,
+
            class Allocator {{=}} allocator<charT> >
+
        class basic_stringbuf;
+
 
+
    template <class charT, class traits {{=}} char_traits<charT>,
+
            class Allocator {{=}} allocator<charT> >
+
        class basic_istringstream;
+
    template <class charT, class traits {{=}} char_traits<charT>,
+
            class Allocator {{=}} allocator<charT> >
+
        class basic_ostringstream;
+
    template <class charT, class traits {{=}} char_traits<charT>,
+
            class Allocator {{=}} allocator<charT> >
+
        class basic_stringstream;
+
       
+
    template <class charT, class traits {{=}} char_traits<charT> >
+
        class basic_filebuf;
+
    template <class charT, class traits {{=}} char_traits<charT> >
+
        class basic_ifstream;
+
    template <class charT, class traits {{=}} char_traits<charT> >
+
        class basic_ofstream;
+
    template <class charT, class traits {{=}} char_traits<charT> >
+
        class basic_fstream;
+
   
+
    template <class charT, class traits {{=}} char_traits<charT> >
+
        class istreambuf_iterator;
+
    template <class charT, class traits {{=}} char_traits<charT> >
+
        class ostreambuf_iterator;
+
 
+
 
+
    typedef basic_ios<char>    ios;   
+
    typedef basic_ios<wchar_t>  wios; 
+
           
+
    typedef basic_streambuf<char>  streambuf;
+
    typedef basic_istream<char>    istream;
+
    typedef basic_ostream<char>    ostream;
+
    typedef basic_iostream<char>    iostream;
+
           
+
    typedef basic_stringbuf<char>      stringbuf;
+
    typedef basic_istringstream<char>  istringstream;
+
    typedef basic_ostringstream<char>  ostringstream;
+
    typedef basic_stringstream<char>    stringstream;
+
           
+
    typedef basic_filebuf<char>    filebuf;
+
    typedef basic_ifstream<char>    ifstream;
+
    typedef basic_ofstream<char>    ofstream;
+
    typedef basic_fstream<char>    fstream;
+
           
+
    typedef basic_streambuf<wchar_t>    wstreambuf;
+
    typedef basic_istream<wchar_t>      wistream;
+
    typedef basic_ostream<wchar_t>      wostream;
+
    typedef basic_iostream<wchar_t>    wiostream;
+
           
+
    typedef basic_stringbuf<wchar_t>        wstringbuf;
+
    typedef basic_istringstream<wchar_t>    wistringstream;
+
    typedef basic_ostringstream<wchar_t>    wostringstream;
+
    typedef basic_stringstream<wchar_t>    wstringstream;
+
           
+
    typedef basic_filebuf<wchar_t>  wfilebuf;       
+
    typedef basic_ifstream<wchar_t> wifstream;     
+
    typedef basic_ofstream<wchar_t> wofstream;     
+
    typedef basic_fstream<wchar_t>  wfstream; 
+
           
+
    template <class state> class fpos;     
+
    typedef fpos<char_traits<char>::state_type> streampos; 
+
    typedef fpos<char_traits<wchar_t>::state_type> wstreampos; 
+
 
+
}   
+
  
}}
+
{{langlinks|es|ja|zh}}

Latest revision as of 07:30, 27 November 2023

 
 
Standard library headers
 

This header contains forward declarations for the Input/output library.

Forward declarations

Defined in header <string>
std::char_traits Class Template which describes properties of a character type (class template)
std::char_traits<char> (class template specialization)
std::char_traits<wchar_t> (class template specialization)
std::char_traits<char8_t> (C++20) (class template specialization)
std::char_traits<char16_t> (C++11) (class template specialization)
std::char_traits<char32_t> (C++11) (class template specialization)
Defined in header <memory>
the default allocator
(class template) [edit]
Defined in header <ios>
manages an arbitrary stream buffer
(class template) [edit]
represents absolute position in a stream or a file
(class template) [edit]
Defined in header <streambuf>
abstracts a raw device
(class template) [edit]
Defined in header <ostream>
wraps a given abstract device (std::basic_streambuf)
and provides high-level output interface
(class template) [edit]
Defined in header <istream>
wraps a given abstract device (std::basic_streambuf)
and provides high-level input interface
(class template) [edit]
wraps a given abstract device (std::basic_streambuf)
and provides high-level input/output interface
(class template) [edit]
Defined in header <fstream>
implements raw file device
(class template) [edit]
implements high-level file stream input operations
(class template) [edit]
implements high-level file stream output operations
(class template) [edit]
implements high-level file stream input/output operations
(class template) [edit]
Defined in header <sstream>
implements raw string device
(class template) [edit]
implements high-level string stream input operations
(class template) [edit]
implements high-level string stream output operations
(class template) [edit]
implements high-level string stream input/output operations
(class template) [edit]
Defined in header <syncstream>
synchronized output device wrapper
(class template) [edit]
synchronized output stream wrapper
(class template) [edit]
Defined in header <spanstream>
implements raw fixed character buffer device
(class template) [edit]
implements fixed character buffer input operations
(class template) [edit]
implements fixed character buffer output operations
(class template) [edit]
implements fixed character buffer input/output operations
(class template) [edit]
Defined in header <strstream>
(deprecated in C++98)(removed in C++26)
implements raw character array device
(class) [edit]
(deprecated in C++98)(removed in C++26)
implements character array input operations
(class) [edit]
(deprecated in C++98)(removed in C++26)
implements character array output operations
(class) [edit]
(deprecated in C++98)(removed in C++26)
implements character array input/output operations
(class) [edit]

Typedefs and specializations

std::streampos std::fpos<std::char_traits<char>::state_type>
std::wstreampos std::fpos<std::char_traits<wchar_t>::state_type>
std::u8streampos std::fpos<std::char_traits<char8_t>::state_type>
std::u16streampos std::fpos<std::char_traits<char16_t>::state_type>
std::u32streampos std::fpos<std::char_traits<char32_t>::state_type>
In addition, for each class template std::basic_T declared in this header, std::T and std::wT are declared as a synonym of std::basic_T<char> and std::basic_T<wchar_t> respectively.

[edit] Synopsis

namespace std {
  template<class CharT> struct char_traits;
  template<> struct char_traits<char>;
  template<> struct char_traits<char8_t>;
  template<> struct char_traits<char16_t>;
  template<> struct char_traits<char32_t>;
  template<> struct char_traits<wchar_t>;
 
  template<class T> class allocator;
 
  template<class CharT, class Traits = char_traits<CharT>>
    class basic_ios;
  template<class CharT, class Traits = char_traits<CharT>>
    class basic_streambuf;
  template<class CharT, class Traits = char_traits<CharT>>
    class basic_istream;
  template<class CharT, class Traits = char_traits<CharT>>
    class basic_ostream;
  template<class CharT, class Traits = char_traits<CharT>>
    class basic_iostream;
 
  template<class CharT, class Traits = char_traits<CharT>,
           class Allocator = allocator<CharT>>
    class basic_stringbuf;
  template<class CharT, class Traits = char_traits<CharT>,
           class Allocator = allocator<CharT>>
    class basic_istringstream;
  template<class CharT, class Traits = char_traits<CharT>,
           class Allocator = allocator<CharT>>
    class basic_ostringstream;
  template<class CharT, class Traits = char_traits<CharT>,
           class Allocator = allocator<CharT>>
    class basic_stringstream;
 
  template<class CharT, class Traits = char_traits<CharT>>
    class basic_filebuf;
  template<class CharT, class Traits = char_traits<CharT>>
    class basic_ifstream;
  template<class CharT, class Traits = char_traits<CharT>>
    class basic_ofstream;
  template<class CharT, class Traits = char_traits<CharT>>
    class basic_fstream;
 
  template<class CharT, class Traits = char_traits<CharT>,
           class Allocator = allocator<CharT>>
    class basic_syncbuf;
  template<class CharT, class Traits = char_traits<CharT>,
           class Allocator = allocator<CharT>>
    class basic_osyncstream;
 
  template<class CharT, class Traits = char_traits<CharT>>
    class basic_spanbuf;
  template<class CharT, class Traits = char_traits<CharT>>
    class basic_ispanstream;
  template<class CharT, class Traits = char_traits<CharT>>
    class basic_ospanstream;
  template<class CharT, class Traits = char_traits<CharT>>
    class basic_spanstream;
 
  template<class CharT, class Traits = char_traits<CharT>>
    class istreambuf_iterator;
  template<class CharT, class Traits = char_traits<CharT>>
    class ostreambuf_iterator;
 
  using ios  = basic_ios<char>;
  using wios = basic_ios<wchar_t>;
 
  using streambuf = basic_streambuf<char>;
  using istream   = basic_istream<char>;
  using ostream   = basic_ostream<char>;
  using iostream  = basic_iostream<char>;
 
  using stringbuf     = basic_stringbuf<char>;
  using istringstream = basic_istringstream<char>;
  using ostringstream = basic_ostringstream<char>;
  using stringstream  = basic_stringstream<char>;
 
  using filebuf  = basic_filebuf<char>;
  using ifstream = basic_ifstream<char>;
  using ofstream = basic_ofstream<char>;
  using fstream  = basic_fstream<char>;
 
  using syncbuf     = basic_syncbuf<char>;
  using osyncstream = basic_osyncstream<char>;
 
  using spanbuf     = basic_spanbuf<char>;
  using ispanstream = basic_ispanstream<char>;
  using ospanstream = basic_ospanstream<char>;
  using spanstream  = basic_spanstream<char>;
 
  using wstreambuf = basic_streambuf<wchar_t>;
  using wistream   = basic_istream<wchar_t>;
  using wostream   = basic_ostream<wchar_t>;
  using wiostream  = basic_iostream<wchar_t>;
 
  using wstringbuf     = basic_stringbuf<wchar_t>;
  using wistringstream = basic_istringstream<wchar_t>;
  using wostringstream = basic_ostringstream<wchar_t>;
  using wstringstream  = basic_stringstream<wchar_t>;
 
  using wfilebuf  = basic_filebuf<wchar_t>;
  using wifstream = basic_ifstream<wchar_t>;
  using wofstream = basic_ofstream<wchar_t>;
  using wfstream  = basic_fstream<wchar_t>;
 
  using wsyncbuf     = basic_syncbuf<wchar_t>;
  using wosyncstream = basic_osyncstream<wchar_t>;
 
  using wspanbuf     = basic_spanbuf<wchar_t>;
  using wispanstream = basic_ispanstream<wchar_t>;
  using wospanstream = basic_ospanstream<wchar_t>;
  using wspanstream  = basic_spanstream<wchar_t>;
 
  template<class State> class fpos;
  using streampos = fpos<char_traits<char>::state_type>;
  using wstreampos = fpos<char_traits<wchar_t>::state_type>;
  using u8streampos = fpos<char_traits<char8_t>::state_type>;
  using u16streampos = fpos<char_traits<char16_t>::state_type>;
  using u32streampos = fpos<char_traits<char32_t>::state_type>;
}
 
// deprecated
namespace std {
  class strstreambuf;
  class istrstream;
  class ostrstream;
  class strstream;
}