2
0
mirror of https://github.com/boostorg/scope.git synced 2026-01-27 07:22:08 +00:00
Files
scope/test/compile_fail/scope_final_noncopyable.cpp
Andrey Semashev c5635f21cc Implemented scope_check and added support for arbitrary fail conditions.
The new scope_check scope guard is a generalization of scope_success and
scope_fail and allows specifying arbitrary conditions for executing the
scope exit action. The scope_success and scope_fail have been
reimplemented in terms of scope_check and now also support arbitrary
fail conditions.

Added exception_checker and error_code_checker conditions for testing
for an exception being thrown and for an error code, respectively.
scope_success and scope_fail use exception_checker by default.

Added tests for the new components.
2023-03-26 21:02:11 +03:00

26 lines
594 B
C++

/*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* https://www.boost.org/LICENSE_1_0.txt)
*
* Copyright (c) 2023 Andrey Semashev
*/
/*!
* \file scope_final_noncopyable.cpp
* \author Andrey Semashev
*
* \brief This file tests that \c scope_final is noncopyable.
*/
#include <boost/scope/scope_final.hpp>
#include "function_types.hpp"
int main()
{
int n = 0;
boost::scope::scope_final< normal_func > guard1{ normal_func(n) };
boost::scope::scope_final< normal_func > guard2 = guard1;
return 0;
}