|
|
|
|
|
|
|
|
bool executed = false; |
|
|
bool executed = false; |
|
|
|
|
|
|
|
|
{ |
|
|
{ |
|
|
auto guard = sg::scope_guard([&executed] { executed = true; }); |
|
|
|
|
|
|
|
|
auto guard = sr::scope_guard([&executed] { executed = true; }); |
|
|
static_cast<void>(guard); |
|
|
static_cast<void>(guard); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool executed = false; |
|
|
bool executed = false; |
|
|
|
|
|
|
|
|
{ |
|
|
{ |
|
|
auto guard = sg::scope_guard([&executed] { executed = true; }); |
|
|
|
|
|
|
|
|
auto guard = sr::scope_guard([&executed] { executed = true; }); |
|
|
guard.release(); |
|
|
guard.release(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::size_t calls{0}; |
|
|
std::size_t calls{0}; |
|
|
|
|
|
|
|
|
{ |
|
|
{ |
|
|
auto movedFrom = sg::scope_guard([&calls] { ++calls; }); |
|
|
|
|
|
|
|
|
auto movedFrom = sr::scope_guard([&calls] { ++calls; }); |
|
|
auto guard = std::move(movedFrom); |
|
|
auto guard = std::move(movedFrom); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
bool executed = false; |
|
|
bool executed = false; |
|
|
|
|
|
|
|
|
{ |
|
|
{ |
|
|
auto movedFrom = sg::scope_guard([&executed] { executed = true; }); |
|
|
|
|
|
|
|
|
auto movedFrom = sr::scope_guard([&executed] { executed = true; }); |
|
|
auto guard = std::move(movedFrom); |
|
|
auto guard = std::move(movedFrom); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool executed = false; |
|
|
bool executed = false; |
|
|
|
|
|
|
|
|
{ |
|
|
{ |
|
|
auto movedFrom = sg::scope_guard([&executed] { executed = true; }); |
|
|
|
|
|
|
|
|
auto movedFrom = sr::scope_guard([&executed] { executed = true; }); |
|
|
movedFrom.release(); |
|
|
movedFrom.release(); |
|
|
auto guard = std::move(movedFrom); |
|
|
auto guard = std::move(movedFrom); |
|
|
} |
|
|
} |