xtd 0.2.0
Loading...
Searching...
No Matches
overload.hpp
Go to the documentation of this file.
1
4#pragma once
5#include <functional>
6
8namespace xtd {
15 template <typename... args_t>
18
23 template <typename result_t, typename type_t>
24 constexpr auto operator()(result_t (type_t::*method)(args_t...)) const noexcept -> decltype(method) {return method;}
26
28
33 template <typename result_t, typename type_t>
34 static constexpr auto of(result_t (type_t::*method)(args_t...)) noexcept -> decltype(method) {return method;}
36 };
37
42 template <typename... args_t>
45
50 template <typename result_t, typename type_t>
51 constexpr auto operator()(result_t (type_t::*method)(args_t...) const) const noexcept -> decltype(method) {return method;}
53
55
60 template <typename result_t, typename type_t>
61 static constexpr auto of(result_t (type_t::*method)(args_t...) const) noexcept -> decltype(method) {return method;}
63 };
64
69 template <typename... args_t>
70 struct overload : const_overload<args_t...>, non_const_overload<args_t...> {
72 using const_overload<args_t...>::of;
73 using const_overload<args_t...>::operator();
74 using non_const_overload<args_t...>::of;
75 using non_const_overload<args_t...>::operator();
77
79
84 template <typename result_t>
85 constexpr auto operator()(result_t (*method)(args_t...)) const noexcept -> decltype(method) {return method;}
87
89
94 template <typename result_t>
95 static constexpr auto of(result_t (*method)(args_t...)) noexcept -> decltype(method) {return method;}
97 };
98
100 template <typename... args_t>
101 inline const overload<args_t...> overload_;
102
103 template <typename... args_t>
104 inline const const_overload<args_t...> const_overload_;
105
106 template <typename... args_t>
107 inline const non_const_overload<args_t...> non_const_overload_;
109}
110
117#define overload_ xtd::overload_
118
125#define const_overload_ xtd::const_overload_
126
133#define non_const_overload_ xtd::non_const_overload_
#define const_overload_
Helper keyword that use to determine one of const overloaded methods.
Definition overload.hpp:125
#define overload_
Helper keyword that use to determine one of const and non const overloaded methods.
Definition overload.hpp:117
#define non_const_overload_
Helper keyword that use to determine one of non const overloaded methods.
Definition overload.hpp:133
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10
Represents class that use to determine one of const overloaded methods.
Definition overload.hpp:43
static constexpr auto of(result_t(type_t::*method)(args_t...) const) noexcept -> decltype(method)
Returns a pointer to an overloaded method. The template parameter is the list of the argument types o...
Definition overload.hpp:61
constexpr auto operator()(result_t(type_t::*method)(args_t...) const) const noexcept -> decltype(method)
Returns a pointer to an overloaded method. The template parameter is the list of the argument types o...
Definition overload.hpp:51
Represents class that use to determine one of non const overloaded methods.
Definition overload.hpp:16
static constexpr auto of(result_t(type_t::*method)(args_t...)) noexcept -> decltype(method)
Returns a pointer to an overloaded method. The template parameter is the list of the argument types o...
Definition overload.hpp:34
constexpr auto operator()(result_t(type_t::*method)(args_t...)) const noexcept -> decltype(method)
Returns a pointer to an overloaded method. The template parameter is the list of the argument types o...
Definition overload.hpp:24
Represents class that use to determine one of const and non const overloaded methods.
Definition overload.hpp:70
constexpr auto operator()(result_t(*method)(args_t...)) const noexcept -> decltype(method)
Returns a pointer to an overloaded method. The template parameter is the list of the argument types o...
Definition overload.hpp:85
static constexpr auto of(result_t(*method)(args_t...)) noexcept -> decltype(method)
Returns a pointer to an overloaded method. The template parameter is the list of the argument types o...
Definition overload.hpp:95