55 std::vector<const SwapStage*> applied;
56 applied.reserve(stages.size());
61 for (
auto it = applied.rbegin(); it != applied.rend(); ++it) {
62 if (!(*it)->rollback)
continue;
66 result.rollback_clean =
false;
72 for (
const auto& stage : stages) {
75 ok = stage.apply ? stage.apply() :
true;
76 }
catch (
const std::exception& e) {
77 return unwind({
false, stage.name, std::string(
"threw: ") + e.what(),
true});
79 return unwind({
false, stage.name,
"threw (non-std)",
true});
82 return unwind({
false, stage.name,
"stage rejected",
true});
83 applied.push_back(&stage);
85 return {
true,
"",
"",
true};
107 virtual std::string
name()
const = 0;
119 std::vector<SwapStage> stages;
120 stages.reserve(units.size());
121 for (
auto* unit : units) {
122 if (unit) stages.push_back(unit->to_stage());