Просмотр исходного кода

Indication, that intentional unused.

main
offa 8 лет назад
Родитель
Сommit
7a9ae0db95
1 измененных файлов: 3 добавлений и 1 удалений
  1. +3
    -1
      test/ScopeGuardTest.cpp

+ 3
- 1
test/ScopeGuardTest.cpp Просмотреть файл

{ {
auto movedFrom = sr::scope_guard([&calls] { ++calls; }); auto movedFrom = sr::scope_guard([&calls] { ++calls; });
auto guard = std::move(movedFrom); auto guard = std::move(movedFrom);
static_cast<void>(guard);
} }


REQUIRE(calls == 1); REQUIRE(calls == 1);
{ {
auto movedFrom = sr::scope_guard([&executed] { executed = true; }); auto movedFrom = sr::scope_guard([&executed] { executed = true; });
auto guard = std::move(movedFrom); auto guard = std::move(movedFrom);
static_cast<void>(guard);
} }


REQUIRE(executed == true); REQUIRE(executed == true);
auto movedFrom = sr::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);
static_cast<void>(guard);
} }


REQUIRE(executed == false); REQUIRE(executed == false);

Загрузка…
Отмена
Сохранить