void strong_swap(bool &all_good, T &a, T &b)
swap() function provides the weak guarantee i.e. that no resources are lost. This ADL discovered function provides the strong guarantee instead: that if any of these operations throw an exception (i) move construct to temporary (ii) move assign
a (iii) move assign temporary to
b, an attempt is made to restore the exact pre-swapped state upon entry, and if that recovery too fails, then the boolean
all_good will be false during stack unwind from the exception throw, to indicate that state has been lost.
This function is used within
if, and only if, either or both of
error_type have a throwing move constructor or move assignment. It permits you to customise the implementation of the strong guarantee swap in Outcome with a more efficient implementation.
Overridable: By Argument Dependent Lookup (ADL).
T is both move constructible and move assignable.