summaryrefslogtreecommitdiff
path: root/Rx/v2/examples/win_text/unwinder.h
diff options
context:
space:
mode:
Diffstat (limited to 'Rx/v2/examples/win_text/unwinder.h')
-rw-r--r--Rx/v2/examples/win_text/unwinder.h54
1 files changed, 0 insertions, 54 deletions
diff --git a/Rx/v2/examples/win_text/unwinder.h b/Rx/v2/examples/win_text/unwinder.h
deleted file mode 100644
index a01a170..0000000
--- a/Rx/v2/examples/win_text/unwinder.h
+++ /dev/null
@@ -1,54 +0,0 @@
-#pragma once
-
-namespace unwinder { namespace detail {
-
- template<typename Function>
- class unwinder
- {
- public:
- ~unwinder() noexcept
- {
- if (!!function)
- {
- (*function)();
- }
- }
-
- explicit unwinder(Function* functionArg)
- : function(functionArg)
- {
- }
-
- void dismiss()
- {
- function = nullptr;
- }
-
- unwinder& operator=(nullptr_t) {
- dismiss();
- return *this;
- }
-
- private:
- unwinder();
- unwinder(const unwinder&);
- unwinder& operator=(const unwinder&);
-
- Function* function;
- };
-} }
-
-#define UNWIND_MAKE_IDENTIFIER_EXPLICIT_PASTER(Prefix, Suffix) Prefix ## Suffix
-#define UNWIND_MAKE_IDENTIFIER_EXPLICIT(Prefix, Suffix) UNWIND_MAKE_IDENTIFIER_EXPLICIT_PASTER(Prefix, Suffix)
-
-#define UNWIND_MAKE_IDENTIFIER(Prefix) UNWIND_MAKE_IDENTIFIER_EXPLICIT(Prefix, __LINE__)
-
-#define ON_UNWIND(Name, Function) \
- ON_UNWIND_EXPLICIT(uwfunc_ ## Name, Name, Function)
-
-#define ON_UNWIND_AUTO(Function) \
- ON_UNWIND_EXPLICIT(UNWIND_MAKE_IDENTIFIER(uwfunc_), UNWIND_MAKE_IDENTIFIER(unwind_), Function)
-
-#define ON_UNWIND_EXPLICIT(FunctionName, UnwinderName, Function) \
- auto FunctionName = (Function); \
- ::unwinder::detail::unwinder<decltype(FunctionName)> UnwinderName(std::addressof(FunctionName))