xtd 0.2.0
Loading...
Searching...
No Matches
call_once.h
Go to the documentation of this file.
1
4#pragma once
5#include <utility>
6
8namespace xtd {
19 struct call_once {
20 };
21
23 template<typename function_t>
24 struct __xtd_call_once_object__ {
25 __xtd_call_once_object__(function_t function) { function(); }
26 };
27
28 template<typename function_t>
29 auto operator +(call_once, function_t&& function) {
30 return __xtd_call_once_object__<function_t>{std::forward<function_t>(function)};
31 }
33}
34
36#define __xtd_call_once_cat__(name, line) name##line
37#define __xtd_call_once_id__(name, line) __xtd_call_once_cat__(name, line)
39
50#define call_once_ [[maybe_unused]] static auto __xtd_call_once_id__(__xtd__call_once__, __LINE__) = xtd::call_once {} + [&]
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10
The xtd::call_once struct can be used to execute a routine exactly once. This can be used to initiali...
Definition call_once.h:19