◐ Shell
clean mode source ↗

noexcept operator (seit C++11) – cppreference.com

Aus cppreference.com

<metanoindex/>

Die noexcept Operator führt einen Compiler-Check, der true zurückgibt, wenn ein Ausdruck erklärt nicht werfen keine Ausnahmen .

Original:

The noexcept operator performs a compile-time check that returns true if an expression is declared to not throw any exceptions.

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

Syntax

noexcept( expression )

Gibt ein Objekt vom Typ bool .

Original:

Returns an object of type bool.

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

Erklärung

Die noexcept Betreiber nicht beurteilen expression. Das Ergebnis ist, wenn die false expression enthält mindestens eine der folgenden potenziell ausgewertet Konstrukte:

Original:

The noexcept operator does not evaluate expression. The result is false if the expression contains at least one of the following potentially evaluated constructs:

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

  • throw Ausdruck

    Original:

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

  • dynamic_cast Ausdruck, wenn die Umwandlung eine Laufzeit Prüfung muss

    Original:

    dynamic_cast expression when the conversion needs a run time check

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

  • typeid Ausdruck, wenn Argumenttyp polymorphe Klasse Typ ist

    Original:

    typeid expression when argument type is polymorphic class type

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

In allen anderen Fällen ist das Ergebnis true .

Original:

In all other cases the result is true.

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

Keywords

noexcept

Beispiel

template <class T>
void self_assign(T& t) noexcept(noexcept(T::operator=)) 
{ // self_assign is noexcept if and only if T::operator= is noexcept
    t = t;
}

Siehe auch

noexcept Spezifizierer

erfordert eine Funktion nicht werfen keine Ausnahmen (C++11)

Original:

requires a function to not throw any exceptions (C++11)

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

[edit]
Exception-Spezifikation

legt fest, welche Ausnahmen von einer Funktion (veraltet) geworfen werden

Original:

specifies what exceptions are thrown by a function (veraltet)

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

[edit]