std::unique_ptr::operator*
Aus cppreference.com
< cpp | memory | unique 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. |
typename std::add_lvalue_reference<T>::type operator*() const; |
(1) | (seit C++11) |
pointer operator->() const; |
(2) | (seit C++11) |
operator*
und operator->
bieten Zugriff auf das Objekt durch *this besaß .Original:
operator*
and operator->
provide access to the object owned by *this.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
(None)
Original:
(none)
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.
[Bearbeiten] Rückgabewert
1)Gibt das Objekt durch *this Besitz, also *get() .
2) Original:
Returns the object owned by *this, i.e. *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.
Gibt einen Zeiger auf das Objekt durch *this Besitz, dh get() .
Original:
Returns a pointer to the object owned by *this, i.e. 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.
[Bearbeiten] Ausnahmen
1)werfen kann
2)
Original:
may throw
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.
[Bearbeiten] Beispiel
#include <iostream> #include <memory> struct Foo { void bar() { std::cout << "Foo::bar\n"; } }; void f(const Foo& foo) { std::cout << "f(const Foo&)\n"; } int main() { std::unique_ptr<Foo> ptr(new Foo); ptr->bar(); f(*ptr); }
Output:
Foo::bar f(const Foo&)
[Bearbeiten] Siehe auch
liefert einen Zeiger auf das verwaltete Objekt 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. (öffentliche Elementfunktion) |