std::shared_ptr::operator<<
De cppreference.com
|
|
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. |
<metanoindex/>
<tbody> </tbody> template <class T, class U, class V> basic_ostream<U, V>& operator<<(basic_ostream<U, V>& os, const shared_ptr<T>& ptr); |
||
Insère un
shared_ptr<T> dans un 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.
Equivalent à
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.
Paramètres
| os | - | un std::basic_ostream à insérer dans
ptr 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 | - | les données à insérer dans
os 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. |
Retourne la valeur
os
Exemple
#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;
}
Résultat possible :
0x6d9028
0x6d9028
Voir aussi
renvoie un pointeur sur l'objet géré Original: returns a pointer to the managed object The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction membre publique) | |