operator==,!=,<,<=,>,>=(std::unique_ptr) – cppreference.com
<metanoindex/>
<tbody> </tbody>
|
|
(1) | (seit C++11) |
|
|
(2) | (seit C++11) |
|
|
(3) | (seit C++11) |
|
|
(4) | (seit C++11) |
|
|
(5) | (seit C++11) |
|
|
(6) | (seit C++11) |
|
|
(7) | (seit C++11) |
|
|
(8) | (seit C++11) |
|
|
(9) | (seit C++11) |
|
|
(10) | (seit C++11) |
|
|
(11) | (seit C++11) |
|
|
(12) | (seit C++11) |
|
|
(13) | (seit C++11) |
|
|
(14) | (seit C++11) |
|
|
(15) | (seit C++11) |
|
|
(16) | (seit C++11) |
|
|
(17) | (seit C++11) |
|
|
(18) | (seit C++11) |
Vergleicht die Pointer-Werte von zwei unique_ptrs oder eine unique_ptr und nullptr .
Original:
Compares the pointer values of two unique_ptrs, or a unique_ptr and nullptr.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Parameter
| x, y | - |
Original:
The text has been machine-translated via Google Translate. |
Rückgabewert
1) x.get() == y.get()
2) x.get() != y.get()
3)
std::less<CT>()(x.get(), y.get()), wo CT ist std::common_type<unique_ptr<T1, D1>::pointer, unique_ptr<T2, D2>::pointer>::type
Original:
std::less<CT>()(x.get(), y.get()), where CT is std::common_type<unique_ptr<T1, D1>::pointer, unique_ptr<T2, D2>::pointer>::type
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
4) !(y < x)
5) y < x
6) !(x < y)
7-8) !x
9-10) (bool)x
11) std::less<unique_ptr<T,D>::pointer>()(x.get(), nullptr)
12) std::less<unique_ptr<T,D>::pointer>()(nullptr, y.get())
13) nullptr < x
14) y < nullptr
15) !(nullptr < x)
16) !(y < nullptr)
17) !(x < nullptr)
18) !(nullptr < y)
Beispiel
#include <iostream> #include <memory> int main() { std::unique_ptr<int> p1(new int(42)); std::unique_ptr<int> p2(new int(42)); std::cout << "p1 == p1: " << (p1 == p1) << '\n'; // p1 and p2 point to different memory locations, so p1 != p2 std::cout << "p1 == p2: " << (p1 == p2) << '\n'; }
Output:
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. (öffentliche Elementfunktion) [edit] | |