• Class / Function / Type

      std::
    • Header file

      <>
    • Other / All

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

    履歴 編集

    function
    <memory>

    std::shared_ptr::operator*

    // 非配列版、非void版のみ
    T& operator*() const noexcept;
    

    概要

    ポインタを間接参照する。

    要件

    get() != nullptr
    

    戻り値

    *get()

    備考

    #include <iostream>
    #include <memory>
    
    int main()
    {
      std::shared_ptr<int> p(new int(3));
    
      int& r = *p;
      std::cout << r << std::endl;
    }
    

    出力

    3
    

    バージョン

    言語

    • C++11

    処理系

    参照