|
3 | 3 | #ifndef BEMAN_SCOPE_HPP |
4 | 4 | #define BEMAN_SCOPE_HPP |
5 | 5 |
|
6 | | -namespace beman::scope {} // namespace beman::scope |
| 6 | +namespace beman::scope { |
| 7 | + |
| 8 | +// -- 7.6.7 Feature test macro -- |
| 9 | +// |
| 10 | +// __cpp_lib_scope |
| 11 | +// |
| 12 | + |
| 13 | +// -- 7.5.1 Header <scope> synopsis [scope.syn] -- |
| 14 | +// |
| 15 | +// namespace std { |
| 16 | +// template <class EF> |
| 17 | +// class scope_exit; |
| 18 | +// |
| 19 | +// template <class EF> |
| 20 | +// class scope_fail; |
| 21 | +// |
| 22 | +// template <class EF> |
| 23 | +// class scope_success; |
| 24 | +// |
| 25 | +// template <class R, class D> |
| 26 | +// class unique_resource; |
| 27 | +// |
| 28 | +// // factory function |
| 29 | +// template <class R, class D, class S = decay_t<R>> |
| 30 | +// unique_resource<decay_t<R>, decay_t<D>> |
| 31 | +// make_unique_resource_checked(R&& r, const S& invalid, D&& d) noexcept(see below); |
| 32 | +// } // namespace std |
| 33 | +// |
| 34 | + |
| 35 | +// -- 7.5.2 Scope guard class templates [scope.scope_guard] -- |
| 36 | +// |
| 37 | +// template <class EF> |
| 38 | +// class scope_guard { |
| 39 | +// public: |
| 40 | +// template <class EFP> |
| 41 | +// explicit scope_guard(EFP&& f) noexcept(see below); |
| 42 | +// |
| 43 | +// scope_guard(scope_guard&& rhs) noexcept(see below); |
| 44 | +// |
| 45 | +// scope_guard(const scope_guard&) = delete; |
| 46 | +// scope_guard& operator=(const scope_guard&) = delete; |
| 47 | +// scope_guard& operator=(scope_guard&&) = delete; |
| 48 | +// |
| 49 | +// ~scope_guard() noexcept(see below); |
| 50 | +// |
| 51 | +// void release() noexcept; |
| 52 | +// |
| 53 | +// private: |
| 54 | +// EF exit_function; // exposition only |
| 55 | +// bool execute_on_destruction{true}; // exposition only |
| 56 | +// int uncaught_on_creation{uncaught_exceptions()}; // exposition only |
| 57 | +// }; |
| 58 | +// |
| 59 | +// template <class EF> |
| 60 | +// scope_guard(EF) -> scope_guard<EF>; |
| 61 | +// |
| 62 | + |
| 63 | +// -- 7.6.1 Class template unique_resource [scope.unique_resource.class] -- |
| 64 | +// |
| 65 | +// template <class R, class D> |
| 66 | +// class unique_resource { |
| 67 | +// public: |
| 68 | +// unique_resource(); |
| 69 | +// template <class RR, class DD> |
| 70 | +// unique_resource(RR&& r, DD&& d) noexcept(see below); |
| 71 | +// unique_resource(unique_resource&& rhs) noexcept(see below); |
| 72 | +// ~unique_resource(); |
| 73 | +// unique_resource& operator=(unique_resource&& rhs) noexcept(see below); |
| 74 | +// void reset() noexcept; |
| 75 | +// template <class RR> |
| 76 | +// void reset(RR&& r); |
| 77 | +// void release() noexcept; |
| 78 | +// const R& get() const noexcept; |
| 79 | +// see below operator*() const noexcept; |
| 80 | +// R operator->() const noexcept; |
| 81 | +// const D& get_deleter() const noexcept; |
| 82 | +// |
| 83 | +// private: |
| 84 | +// using R1 = conditional_t<is_reference_v<R>, // |
| 85 | +// reference_wrapper<remove_reference_t<R>>, // |
| 86 | +// R>; // exposition only |
| 87 | +// |
| 88 | +// R1 resource; // exposition only |
| 89 | +// D deleter; // exposition only |
| 90 | +// bool execute_on_reset{true}; // exposition only |
| 91 | +// }; |
| 92 | +// |
| 93 | +// template <typename R, typename D> |
| 94 | +// unique_resource(R, D) -> unique_resource<R, D>; |
| 95 | + |
| 96 | +} // namespace beman::scope |
7 | 97 |
|
8 | 98 | #endif // BEMAN_SCOPE_HPP |
0 commit comments