3 ms·
regarding noexcept. Honestly, `noexcept` is more documentation than anything else. Its specification merely guarantees that if the function does throw, you get
by toolslive 6y ago
regarding noexcept.
Honestly, `noexcept` is more documentation than anything else. Its specification merely guarantees that if the function does throw, you get a call to `std::terminate` (which aborts).
It's just another thing you cannot really really trust.
- senkora 6y agonoexcept is also important for optimization. If a template function is guaranteed to be exception-safe, and it’s called with a type whose move constructor isn’t noexcept, then the function needs to fallback to the copy constructor to maintain exception-safety. This happens a lot with the standard library.
- nicoburns 6y agoIt would be better if it could actually statically guarantee that the function doesn't throw though!