nullptr pointer literal
Aus 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/>
Syntax
nullptr
|
(seit C++11) | ||||||||
Erklrung
Das Schlsselwort
nullptr bezeichnet die Null-Zeiger-Literal. Es ist ein nicht nher spezifizierter prvalue vom Typ std::nullptr_t. Es gibt impliziten Konvertierungen
von Original:
implicit conversions
The text has been machine-translated via [http://translate.google.com Google Translate].
You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.
You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.
nullptr zum Null-Zeiger Wert eines Zeigers Art und jeder Zeiger auf Elementtyp. hnliche Umsetzungen gibt es fr jeden Wert des Typs std::nullptr_t sowie fr den Makro NULL, der Null-Zeiger konstanten .Original:
The keyword
nullptr denotes the null pointer literal. It is an unspecified prvalue of type std::nullptr_t. There exist impliziten Konvertierungen
from Original:
implicit conversions
The text has been machine-translated via [http://translate.google.com Google Translate].
You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.
You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.
nullptr to null pointer value of any pointer type and any pointer to member type. Similar conversions exist for any value of type std::nullptr_t as well as for the macro NULL, the null pointer constant.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.
Beispiel
Veranschaulicht, wie nullptr Weiterleitung ber eine Template-Funktion ermglicht .
Original:
Demonstrates how nullptr allows forwarding via a template function.
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.
#include <cstddef>
#include <iostream>
template<class F, class A>
void Fwd(F f, A a)
{
f(a);
}
void g(int* i)
{
std::cout << "Function g called\n";
}
int main()
{
g(NULL); // Fine
g(0); // Fine
Fwd(g, nullptr); // Fine
// Fwd(g, NULL); // ERROR: No function g(int)
}
Output:
Function g called
Function g called
Function g called
Keywords
Siehe auch
Implementierung definiert Null-Zeiger konstant Original: implementation-defined null pointer constant The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (Makro konstant) | |
(C++11) |
die Art der Null-Zeiger wrtliche nullptr Original: the type of the null pointer literal nullptr The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (typedef) |