home | help
std::experi...::scope_fail(3)  C++ Standard Libary std::experi...::scope_fail(3)

NAME
     std::experimental::scope_fail - std::experimental::scope_fail

Synopsis
	Defined in header <experimental/scope>
	template< class EF >			(library fundamentals TS v3)
	class scope_fail;

	The  class template scope_fail is a general-purpose scope guard intended
     to call its
	exit function when a scope is exited via an exception.

	scope_fail is not CopyConstructible, CopyAssignable  or  MoveAssignable,
     however, it
	may  be  MoveConstructible  if EF meets some requirements, which permits
     wrapping a
	scope_fail into another object.

	A scope_fail may be either active, i.e. calls its exit function  on  de-
     struction, or
	inactive, i.e. does nothing on destruction. A scope_fail is active after
     constructed
	from an exit function.

	A scope_fail can become inactive by calling release() on it either manu-
     ally or
	automatically (by the move constructor). An inactive scope_fail may also
     be obtained
	by  initializing  with another inactive scope_fail. Once a scope_fail is
     inactive, it
	cannot become active again.

	A scope_fail effectively holds an EF and a bool flag indicating if it is
     active,
	alongwith a counter of uncaught exceptions used  for  detecting  whether
     the destructor
	is called during stack unwinding.

Template parameters
	EF		      - 		  type of stored exit function

Type requirements
	-
	EF shall be either:
	  * a Destructible FunctionObject type,
	  * an lvalue reference to FunctionObject,
	  * an lvalue reference to function.
	-
	Calling  an lvalue of std::remove_reference_t<EF> with no argument shall
     be
	well-formed.

Member functions
	constructor   constructs a new scope_fail
		      (public member function)
		      calls the exit function when the scope is  exited  via  an
     exception if
	destructor    the scope_fail is active, then destroys the scope_fail
		      (public member function)
	operator=     scope_fail is not assignable
	[deleted]     (public member function)

Modifiers
	release       makes the scope_fail inactive
		      (public member function)

	Deduction guides

Notes
	Constructing  a scope_fail of dynamic storage duration might lead to un-
     expected
	behavior.

	Constructing a scope_fail is constructed from another scope_fail created
     in a
	different thread might also lead to unexpected behavior since the  count
     of uncaught
	exceptions  obtained in different threads may be compared during the de-
     struction.

Example
	 This section is incomplete
	 Reason: no example

See also
	scope_exit     wraps a function object and invokes  it	on  exiting  the
     scope
		       (class template)
	scope_success	wraps  a  function  object and invokes it on exiting the
     scope normally
		       (class template)
	default_delete default deleter for unique_ptr
	(C++11)        (class template)

Category:
	  * Todo no example

http://cppreference.com 	   2024.06.10	   std::experi...::scope_fail(3)

home | help