exception specification
Lists the exceptions that a function might directly or indirectly throw.
Syntax
throw( Template:sparam)
|
(1) | (deprecated) | |||||||
noexcept( Template:sparam)
|
(2) | Template:mark c++11 feature | |||||||
Explanation
1) If a function is declared with type T
listed in its exception specification, the function may throw exceptions of that type or a type derived from it.
If the function throws an exception of the type not listed in its exception specification, the function Template:cpp is called. The default function calls Template:cpp, but it may be replaced by a user-provided function which may call Template:cpp or throws an exception. If the exception thrown from Template:cpp is accepted by the exception specification, stack unwinding continues as usual. If it isn't, but Template:cpp is allowed by the exception specification, Template:cpp is thrown. Otherwise, Template:cpp is called:
2) see noexcept
specifier