名前空間
変種
操作

std::shared_ptr<T>::operator<<

提供: cppreference.com
< cpp‎ | memory‎ | shared ptr
 
 
ユーティリティライブラリ
汎用ユーティリティ
日付と時間
関数オブジェクト
書式化ライブラリ (C++20)
(C++11)
関係演算子 (C++20で非推奨)
整数比較関数
(C++20)
スワップと型操作
(C++14)
(C++11)
(C++11)
(C++11)
(C++17)
一般的な語彙の型
(C++11)
(C++17)
(C++17)
(C++17)
(C++17)

初等文字列変換
(C++17)
(C++17)
 
動的メモリ管理
スマートポインタ
(C++11)
(C++11)
(C++11)
(C++17未満)
(C++11)
アロケータ
メモリリソース
未初期化記憶域
ガベージコレクションサポート
その他
(C++20)
(C++11)
(C++11)
C のライブラリ
低水準のメモリ管理
 
 
template <class T, class U, class V>
std::basic_ostream<U, V>& operator<<(std::basic_ostream<U, V>& os, const std::shared_ptr<T>& ptr);

ptr に格納されているポインタの値を出力ストリーム os に挿入します。

os << ptr.get() と同等です。

目次

[編集] 引数

os - ptr を挿入する std::basic_ostream
ptr - os に挿入されるデータ

[編集] 戻り値

os

[編集]

#include <iostream>
#include <memory>
 
class Foo {};
 
int main()
{
    auto sp = std::make_shared<Foo>();
    std::cout << sp << '\n';
    std::cout << sp.get() << '\n';
}

出力例:

0x6d9028
0x6d9028

[編集] 関連項目

格納されているポインタを返します
(パブリックメンバ関数) [edit]