|
NexusForce 1.0.0
A Modern C++ Library with extended functionality, web components, and utility libraries
|
作用域退出守卫 更多...
#include <scope.hpp>
Public 成员函数 | |
| template<typename F, enable_if_t<!is_same_v< remove_cvref_t< F >, scope_exit > &&is_constructible_v< Func, F > &&!is_nothrow_constructible_v< Func, F >, int > = 0> | |
| scope_exit (F &&func) | |
| 构造函数(异常不安全) | |
| template<typename F, enable_if_t<!is_same_v< remove_cvref_t< F >, scope_exit > &&is_constructible_v< Func, F > &&is_nothrow_constructible_v< Func, F >, int > = 0> | |
| scope_exit (F &&func) noexcept | |
| 构造函数(异常安全) | |
| scope_exit (scope_exit &&rhs) noexcept(is_nothrow_move_constructible_v< Func >) | |
| 移动构造函数 | |
| ~scope_exit () noexcept | |
| 析构函数 | |
| void | release () noexcept |
| 释放守卫 | |
作用域退出守卫
| Func | 可调用对象类型 |
在作用域退出时无条件执行指定的函数(无论是否发生异常)。
|
inlineexplicit |
构造函数(异常不安全)
| F | 函数对象类型 |
| func | 要执行的函数对象 |
如果函数对象构造过程中抛出异常,会立即执行func()进行清理。
引用了 forward().
被这些函数引用 scope_exit().
|
inlineexplicitnoexcept |
|
inlinenoexcept |
移动构造函数
| rhs | 要移动的守卫对象 |
转移所有权,原守卫对象被释放。
引用了 is_nothrow_move_constructible_v, move() , 以及 scope_exit().
|
inlinenoexcept |
|
inlinenoexcept |