Re: I think I've found a solution to noexcept!
On 29 Apr., 02:59, DeMarcus wrote:
In the beginning noexcept was proposed by David Abrahams as a
tool to ensure the strong exception safety guarantee, but in
the latest draft it has nothing to do with that, no.
It still does. His example of a growing vector uses
std::move_if_noexcept for conditionally moving elements from a smaller
memory block to a larger one. This way, he can make the strong
exception guarantee. std::move_if_noexcept relies on exception
specifications and type traits. So, yes, noexcept (and related things)
still allow you to make the strong guarantee while exploiting non-
throwing move ctors.
By the way, I still don't understand what optimization we get from
using noexcept. Does anyone know how it works under the hood?
noexcept(true) differs from throw() in that stack unwinding is not
required. This allows compilers to omit some exception handling code
in functions that don't invoke any non-noexcept(true) functions.
(That's my current understanding and not necessarily correct). I think
this has been said else-thread already.
SG
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]