• Class / Function / Type

      std::
    • Header file

      <>
    • Other / All

    最終更新日時(UTC):
    が更新

    履歴 編集

    function
    <iterator>

    std::istreambuf_iterator::operator*

    CharT operator*() const
    

    概要

    イテレータを間接参照する。

    戻り値

    sbuf_->sgetc()で文字を読み込んで返す。

    sbuf_はメンバ変数として保持しているstreambuf_typeオブジェクトへのポインタ

    #include <iostream>
    #include <iterator>
    #include <sstream>
    
    int main()
    {
      std::stringstream ss;
      ss << "123";
    
      std::istreambuf_iterator<char> it(ss);
      std::cout << *it << std::endl;
    }
    

    出力

    1
    

    参照