1+++ 2title = "`void strong_swap(bool &all_good, T &a, T &b)`" 3description = "Tries to perform a strong guarantee swap." 4+++ 5 6The standard `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 `b` to `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. 7 8This function is used within `basic_result::`{{% api "swap(basic_result &)" %}} if, and only if, either or both of `value_type` or `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. 9 10*Overridable*: By Argument Dependent Lookup (ADL). 11 12*Requires*: That `T` is both move constructible and move assignable. 13 14*Namespace*: `BOOST_OUTCOME_V2_NAMESPACE` 15 16*Header*: `<boost/outcome/basic_result.hpp>` 17