std::shared_ptr<T>::operator<<
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 |
| 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
См. также
| возвращает сохранённый указатель (публичный метод) |
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/w/cpp/memory/shared_ptr/operator_ltlt