6#if !defined(__XTD_CORE_INTERNAL__)
7#error "Do not include this file: Internal use only"
14#define __xtd_finally_cat__(name, line) name##line
15#define __xtd_finally_id__(name, line) __xtd_finally_cat__(name, line)
17#define __xtd_scope_cat__(name, line) name##line
18#define __xtd_scope_id__(name, line) __xtd_scope_cat__(name, line)
20template<
typename function_t>
21struct __xtd_finally_object__ {
22 __xtd_finally_object__(function_t&& f) :
function(std::forward<function_t>(
f)) {}
23 ~__xtd_finally_object__() {
function(); }
27template<
typename function_t>
28struct __xtd_scope_exit_object__ {
29 __xtd_scope_exit_object__(function_t&& f) :
function(std::forward<function_t>(
f)) {}
30 ~__xtd_scope_exit_object__() {
function(); }
34template<
typename function_t>
35struct __xtd_scope_fail_object__ {
36 __xtd_scope_fail_object__(function_t&& f) :
function(std::forward<function_t>(
f)) {}
37 ~__xtd_scope_fail_object__() noexcept {
if (std::uncaught_exceptions() > exceptions_on_enter)
function();}
38 int exceptions_on_enter = std::uncaught_exceptions();
42template<
typename function_t>
43struct __xtd_scope_success_object__ {
44 __xtd_scope_success_object__(function_t&& f) :
function(std::forward<function_t>(
f)) {}
45 ~__xtd_scope_success_object__() noexcept {
if (std::uncaught_exceptions() == exceptions_on_enter)
function();}
46 int exceptions_on_enter = std::uncaught_exceptions();
@ f
The F key.
Definition console_key.hpp:98