You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
std::operator throw is a customization point, similar to customization point objects, but it does not need to be explicitly called.
The compiler provides an option to change the behavior of throw expression:
If -enable-throw-overloads is on:
throw expr;
will transform to:
throw std::operatorthrow(expr);
This feature is opt-in, allowing the code to support both new and old exception objects simultaneously, without needing to maintain two versions (especially for the standard library). The transform applies before throwing, it is almost zero-cost.
Last year, I proposed this with the goal of simplifying the make_exception_object idiom, but recently I believe it helps users and the standard library transform to using Herbceptions.
The text was updated successfully, but these errors were encountered:
std::operator throw
is a customization point, similar to customization point objects, but it does not need to be explicitly called.The compiler provides an option to change the behavior of
throw
expression:If
-enable-throw-overloads
is on:throw expr;
will transform to:
This feature is opt-in, allowing the code to support both new and old exception objects simultaneously, without needing to maintain two versions (especially for the standard library). The transform applies before throwing, it is almost zero-cost.
Last year, I proposed this with the goal of simplifying the
make_exception_object
idiom, but recently I believe it helps users and the standard library transform to using Herbceptions.The text was updated successfully, but these errors were encountered: