Namespaces
Variants

Standard library header <istream>

From cppreference.net
Standard library headers

このヘッダは input/output ライブラリの一部です。

目次

クラス

与えられた抽象デバイス ( std::basic_streambuf ) をラップし、
高レベル入力インターフェースを提供する
(クラステンプレート)
std::istream std:: basic_istream < char >
(typedef)
std::wistream std:: basic_istream < wchar_t >
(typedef)
与えられた抽象デバイス ( std::basic_streambuf ) をラップし、
高レベル入出力インターフェースを提供する
(クラステンプレート)
std::iostream std:: basic_iostream < char >
(typedef)
std::wiostream std:: basic_iostream < wchar_t >
(typedef)

関数

文字と文字配列を抽出する
(関数テンプレート)
マニピュレータ
空白文字を消費する
(関数テンプレート)

概要

namespace std {
  template<class CharT, class Traits = char_traits<CharT>>
    class basic_istream;
  using istream  = basic_istream<char>;
  using wistream = basic_istream<wchar_t>;
  template<class CharT, class Traits = char_traits<CharT>>
    class basic_iostream;
  using iostream  = basic_iostream<char>;
  using wiostream = basic_iostream<wchar_t>;
  template<class CharT, class Traits>
    basic_istream<CharT, Traits>& ws(basic_istream<CharT, Traits>& is);
  template<class Istream, class T>
    Istream&& operator>>(Istream&& is, T&& x);
}
(注:指定された条件により、HTMLタグ・属性、 タグ内のC++コード、C++専門用語はすべて原文のまま保持されています。翻訳対象となる自然言語テキストが存在しないため、出力は入力と同一です。)

クラステンプレート std::basic_istream

namespace std {
  template<class CharT, class Traits = char_traits<CharT>>
  class basic_istream : virtual public basic_ios<CharT, Traits> {
  public:
    // 型 (basic_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;
    // コンストラクタ/デストラクタ
    explicit basic_istream(basic_streambuf<CharT, Traits>* sb);
    virtual ~basic_istream();
    // プレフィックス/サフィックス
    class sentry;
    // フォーマットされた入力
    basic_istream& operator>>(basic_istream& (*pf)(basic_istream&));
    basic_istream& operator>>(basic_ios<CharT, Traits>& (*pf)(basic_ios<CharT, Traits>&));
    basic_istream& operator>>(ios_base& (*pf)(ios_base&));
    basic_istream& operator>>(bool& n);
    basic_istream& operator>>(short& n);
    basic_istream& operator>>(unsigned short& n);
    basic_istream& operator>>(int& n);
    basic_istream& operator>>(unsigned int& n);
    basic_istream& operator>>(long& n);
    basic_istream& operator>>(unsigned long& n);
    basic_istream& operator>>(long long& n);
    basic_istream& operator>>(unsigned long long& n);
    basic_istream& operator>>(float& f);
    basic_istream& operator>>(double& f);
    basic_istream& operator>>(long double& f);
    basic_istream& operator>>(/*拡張浮動小数点型*/& f);
    basic_istream& operator>>(void*& p);
    basic_istream& operator>>(basic_streambuf<char_type, Traits>* sb);
    // 未フォーマット入力
    streamsize gcount() const;
    int_type get();
    basic_istream& get(char_type& c);
    basic_istream& get(char_type* s, streamsize n);
    basic_istream& get(char_type* s, streamsize n, char_type delim);
    basic_istream& get(basic_streambuf<char_type, Traits>& sb);
    basic_istream& get(basic_streambuf<char_type, Traits>& sb, char_type delim);
    basic_istream& getline(char_type* s, streamsize n);
    basic_istream& getline(char_type* s, streamsize n, char_type delim);
    basic_istream& ignore(streamsize n = 1, int_type delim = Traits::eof());
    int_type       peek();
    basic_istream& read    (char_type* s, streamsize n);
    streamsize     readsome(char_type* s, streamsize n);
    basic_istream& putback(char_type c);
    basic_istream& unget();
    int sync();
    pos_type tellg();
    basic_istream& seekg(pos_type);
    basic_istream& seekg(off_type, ios_base::seekdir);
  protected:
    // コピー/ムーブコンストラクタ
    basic_istream(const basic_istream&) = delete;
    basic_istream(basic_istream&& rhs);
    // 代入と交換
    basic_istream& operator=(const basic_istream&) = delete;
    basic_istream& operator=(basic_istream&& rhs);
    void swap(basic_istream& rhs);
  };
  // 文字抽出テンプレート
  template<class CharT, class Traits>
    basic_istream<CharT, Traits>& operator>>(basic_istream<CharT, Traits>&, CharT&);
  template<class Traits>
    basic_istream<char, Traits>& operator>>(basic_istream<char, Traits>&, unsigned char&);
  template<class Traits>
    basic_istream<char, Traits>& operator>>(basic_istream<char, Traits>&, signed char&);
  template<class CharT, class Traits, size_t N>
    basic_istream<CharT, Traits>& operator>>(basic_istream<CharT, Traits>&, CharT(&)[N]
(注:元のテキストが単一の閉じ角括弧のみであるため、HTMLタグを保持したまま、内容を日本語に翻訳する必要はありません。指定された条件に従い、この記号はそのまま維持されます。));
  template<class Traits, size_t N>
    basic_istream<char, Traits>& operator>>(basic_istream<char, Traits>&, unsigned char(&)[N]);
  template<class Traits, size_t N>
    basic_istream<char, Traits>& operator>>(basic_istream<char, Traits>&, signed char(&)[N]
(注:元のテキストは閉じ括弧のみのため、日本語でも同じ記号を保持します));
}

クラス std::basic_istream::sentry

namespace std {
  template<class CharT, class Traits>
  class basic_istream<CharT, Traits>::sentry {
    bool ok_;                   // 説明専用
  public:
    explicit sentry(basic_istream& is, bool noskipws = false);
    ~sentry();
    explicit operator bool() const { return ok_; }
    sentry(const sentry&) = delete;
    sentry& operator=(const sentry&) = delete;
  };
}

クラステンプレート std::basic_iostream

namespace std {
  template<class CharT, class Traits = char_traits<CharT>>
  class basic_iostream
    : public basic_istream<CharT, Traits>,
      public basic_ostream<CharT, Traits> {
  public:
    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;
    // コンストラクタ
    explicit basic_iostream(basic_streambuf<CharT, Traits>* sb);
    // デストラクタ
    virtual ~basic_iostream();
  protected:
    // コンストラクタ
    basic_iostream(const basic_iostream&) = delete;
    basic_iostream(basic_iostream&& rhs);
    // 代入とスワップ
    basic_iostream& operator=(const basic_iostream&) = delete;
    basic_iostream& operator=(basic_iostream&& rhs);
    void swap(basic_iostream& rhs);
  };
}