2
What does the keyword noexcept
in C++ and in what situation it should be used?
2
What does the keyword noexcept
in C++ and in what situation it should be used?
2
Two forms:
Indicates that the function can not launch an exception, which allows a series of optimizations and the compiler better understand the semantics. After that put can not take, is part of the contract. use it whenever possible. In fact until a new form of exception comes, in C++20 or C++23, avoid exceptions.
In C++14 it was a little different, but do not consider this form, prefer the C++17.
See more on documentation.
Used essentially for metaprogramming/reflection enabling selections and specializations than compiling as to what to find. Something much more advanced. It is a way to query during the build if the function can not launch exception.
See more on documentation.
Browser other questions tagged c++ c++11 c++14 c++17
You are not signed in. Login or sign up in order to post.