noexcept operator (ya que C + +11)
De 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. |
El operador
una plantilla de función para declarar que la función excepciones para algunos pero no a otros tipos .noexcept realiza una comprobación en tiempo de compilación que devuelve verdadero si una expresión es declarado no lanzar ninguna excepción .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.
You can help to correct and verify the translation. Click here for instructions.
Original:
It can be used within a function template's
noexcept especificador</div> to declare that the function will throw exceptions for some types but not others.
Original:
noexcept specifier
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.
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.
Contenido |
[editar] Sintaxis
noexcept( expression )
|
|||||||||
Devuelve un objeto de tipo 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.
You can help to correct and verify the translation. Click here for instructions.
[editar] Explicación
El operador
noexcept no expression evaluar. El resultado es false si la expression contiene al menos una de las siguientes construcciones potencialmente evaluados: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.
You can help to correct and verify the translation. Click here for instructions.
- llamar a cualquier tipo de función que no tiene que no lanza especificación de excepciones, a menos que sea un <div class="t-tr-text"> expresión constante.Original:constant expressionThe 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.Original:call to any type of function that does not have non-throwing exception specification, unless it is aexpresión constante</div>.Original:constant expressionThe 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.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. -
throwexpresiónOriginal:throwexpressionThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. -
dynamic_castexpresión cuando la conversión necesita una comprobación tiempo de ejecuciónOriginal:dynamic_castexpression when the conversion needs a run time checkThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. -
typeidexpresión al tipo de argumento es de tipo clase polimórficaOriginal:typeidexpression when argument type is polymorphic class typeThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
-
En todos los demás casos, el resultado es
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.
You can help to correct and verify the translation. Click here for instructions.
[editar] Palabras clave
[editar] Ejemplo
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; }
[editar] Ver también
| noexcept especificador | requiere una función de no arrojar ningún (C++11) excepciones
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. |
| salvo especificación | especifica qué excepciones se producen por un (obsoleto) función
Original: specifies what exceptions are thrown by a function (obsoleto) The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |