+ 4

The noexcept keyword...

I recently encountered another code with the use of noexcept, but the user didn't explain anything. What is this keyword? Where and why is it used? It is related to exception handling somehow?

11th Aug 2017, 12:47 AM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar
2 Answers
+ 4
It lets the compiler and other programmers know that the function / copy/move constructor is expected to not throw exceptions. This allows the compiler to make optimizations.
11th Aug 2017, 1:47 AM
aklex
aklex - avatar
+ 3
@aklex Thanks
11th Aug 2017, 9:43 AM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar