std::shared_ptr<T>::operator<<
来自cppreference.com
| |
||
插入 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 << std::endl;
std::cout << sp.get() << std::endl;
}
可能的输出:
0x6d9028
0x6d9028
