std::shared_ptr::operator<<
Aus cppreference.com
< cpp | memory | shared ptr
![]() | This page has been machine-translated from the English version of the wiki using Google Translate. The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
template<class T, class U, class V> basic_ostream<U, V>& operator<<(basic_ostream<U, V>& os, const shared_ptr<T>& ptr); | ||
Fügt eine
shared_ptr<T>
in eine std::basic_ostream .Original:
Inserts a
shared_ptr<T>
into a std::basic_ostream.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Entspricht
os << ptr.get()
.Original:
Equivalent to
os << ptr.get()
.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Inhaltsverzeichnis |
[Bearbeiten]Parameter
os | - | a std::basic_ostream um ptr eingefügt werden soll Original: a std::basic_ostream to insert ptr into The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
ptr | - | die Daten mit der os eingefügt werden Original: the data to be inserted into os The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
[Bearbeiten]Rückgabewert
os
[Bearbeiten]Beispiel
#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;}
Possible output:
0x6d9028 0x6d9028
[Bearbeiten]Siehe auch
liefert einen Zeiger auf das verwaltete Objekt (öffentliche Elementfunktion) |