The noexcept keyword... | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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
Kinshuk Vasisht
Kinshuk Vasisht - 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
Kinshuk Vasisht
Kinshuk Vasisht - avatar