noexcept operator (начиная с C++11)
Материал из 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. |
noexcept оператор выполняет во время компиляции проверки, которая возвращает истину, если выражение объявляется не бросать исключения.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.
Он может быть использован в течение <div class="t-tr-text"> noexcept спецификатор
шаблон функции, чтобы объявить, что функция будет генерировать исключения для некоторых типов, но не другие.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.
Original:
It can be used within a function template's
noexcept спецификатор</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.
Содержание |
[править] Синтаксис
noexcept( expression )
|
|||||||||
Возвращает объект типа 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.
[править] Объяснение
noexcept оператор не оценить expression. В результате false если expression содержит по меньшей мере одну из следующих потенциально оценивается конструкций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.
- позвонить в любой тип функции, которые не имеют не метание спецификации исключения, если это не <div class="t-tr-text"> постоянное выражение.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 aпостоянное выражение</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. -
throwвыражениеOriginal:throwexpressionThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. -
dynamic_castвыражение, когда преобразование необходимо выполнить проверку временемOriginal: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. -
typeidвыражение, когда аргумент типа полиморфного типа классаOriginal: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.
-
Во всех остальных случаях результат
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.
[править] Ключевые слова
[править] Пример
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; }
[править] См. также
| noexcept спецификатор | требуется функция не бросать исключения (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. |
| Спецификация исключения | указывает, что исключений функцией (устарело)
Original: specifies what exceptions are thrown by a function (устарело) The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |