Template:cpp/experimental/scope guard

The class template is a general-purpose scope guard intended to call its exit function when a scope is.

is not, or , however, it may be  if  meets some requirements, which permits wrapping a  into another object.

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

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

A effectively holds an  and a  flag indicating if it is active.