std::shared_ptr<T>::operator<<
From cppreference.com
< cpp | memory | shared ptr
| 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 | - | std::basic_ostream:ptr を挿入する対象のストリーム |
| 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
[編集] 関連項目
| 格納されたポインターを返す (public メンバー関数) |