std::shared_ptr<T>::operator<<
提供: cppreference.com
<tbody>
</tbody>
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。
例
Run this code
#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
関連項目
| 格納されているポインタを返します (パブリックメンバ関数) |