Difference between revisions of "cpp/language/noexcept"
From cppreference.com
(→Explanation: fix link) |
(→Example: rm excessive space) |
||
Line 35: | Line 35: | ||
t = t; | t = t; | ||
} | } | ||
− | |||
}} | }} | ||
− | |||
===See also=== | ===See also=== | ||
{{rlp|noexcept_spec | {{tt|noexcept}} specifier}}, {{rlp|throw_spec | exception specifications}} | {{rlp|noexcept_spec | {{tt|noexcept}} specifier}}, {{rlp|throw_spec | exception specifications}} |
Revision as of 05:24, 21 October 2011
Template:cpp/language/sidebar Checks whether the evaluation of an expression can throw an exception
Used within noexcept specifier when the fact if the function can throw depends on template parameters.
Contents |
Syntax
noexcept( Template:sparam )
|
|||||||||
Returns an object of type Template:cpp.
Explanation
The noexcept
operator does not evaluate Template:sparam. The result is false
if the Template:sparam contains at least one of the following potentially evaluated constructs:
- call to any type of function, which does not have non-throwing exception specification, unless it is a constant expression.
-
throw
expression -
dynamic_cast
expression when the conversion needs a run time check -
typeid
expression when argument type is polymorphic class type
On all other cases the result is true