◐ Shell
clean mode source ↗

nullptr pointer literal – cppreference.com

Aus cppreference.com

<metanoindex/>

Syntax

nullptr (seit C++11)

Erklärung

Das Schlüsselwort nullptr bezeichnet die Null-Zeiger-Literal. Es ist ein nicht näher spezifizierter prvalue vom Typ std::nullptr_t. Es gibt

impliziten Konvertierungen

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.

von nullptr zum Null-Zeiger Wert eines Zeigers Art und jeder Zeiger auf Elementtyp. Ähnliche Umsetzungen gibt es für jeden Wert des Typs std::nullptr_t sowie für den Makro NULL, der Null-Zeiger konstanten .

Original:

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Beispiel

Veranschaulicht, wie nullptr Weiterleitung über eine Template-Funktion ermöglicht .

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.

#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

nullptr

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) [edit]

die Art der Null-Zeiger wörtliche

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) [edit]