Reputation: 663
There is a quite (very) popular question about the usage of noexcept
, but it's from 8 years ago, and other popular answers are just as old. Seeing some code from other people in different projects, it seems to me that noexcept
didn't become a very common thing for many developers to write.
Besides move constructor and move assignment operator, the benefit of using noexcept
doesn't seems clear enough to think about for every function ("should I add noexcept
here or not?").
Has somebody found a good usage of this specifier, and can share their experience?
Upvotes: 6
Views: 477
Reputation: 4449
Besides the answers in the question that you linked (which continue to be relevant today), there are quite a few specific cases called out in the C++ Core Guidelines that you might want to check out:
noexcept
noexcept
noexcept
swap
noexcept
==
symmetric with respect of operand types and noexcept
hash
noexcept
noexcept
when exiting a function because of a throw
is impossible or unacceptableIt's not a topic to easily summarize as noted by the continued lack of content (as of 03-2021) in the Discussion: Usage of noexcept
section.
Upvotes: 5