Maipa's Standard Library Extension 1.5.6
mstd
Loading...
Searching...
No Matches
functions_types.hpp
1/*
2 * mstd - Maipa's Standard Library
3 *
4 * Licensed under the BSD 3-Clause License with Attribution Requirement.
5 * See the LICENSE file for details: https://github.com/MAIPA01/mstd/blob/main/LICENSE
6 *
7 * Copyright (c) 2025, Patryk Antosik (MAIPA01)
8 */
9
10#pragma once
11#ifndef _MSTD_FUNCTIONS_TYPES_HPP_
12 #define _MSTD_FUNCTIONS_TYPES_HPP_
13
14 #include <mstd/config.hpp>
15
17_MSTD_WARNING("this is only available for c++17 and greater!");
18 #else
19
20 #include <mstd/functions_utils.hpp>
21
22namespace mstd {
23 #pragma region FUNCTIONS_CHECKS
24 template<class F>
25 static _MSTD_CONSTEXPR17 const bool is_function_v =
27
28 template<class F>
30
31 template<class F>
33
35 template<class F> concept func = is_function_v<F>;
36 template<class F> concept action = is_action_v<F>;
37 template<class F> concept method = is_method_v<F>;
38 #endif
39 #pragma endregion
40
41 #pragma region CPP_FUNCTIONS
42 template<class F>
44
45 template<class... Args>
46 using action_t = func_t<void(Args...)>;
47
48 using method_t = action_t<>;
49 #pragma endregion
50
51 #pragma region C_FUNCTIONS
52
53 namespace utils {
54 template<class F, class C, class = void>
55 struct c_func_impl {};
56
57 template<class F, class C>
58 struct c_func_impl<F, C, std::void_t<std::enable_if_t<mstd::is_function_v<F>, bool> > > {
59 using type = F C::*;
60 };
61
62 template<class F>
63 struct c_func_impl<F, void, std::void_t<std::enable_if_t<mstd::is_function_v<F>, bool> > > {
64 using type = F*;
65 };
66 } // namespace utils
67
68 template<class F>
70
71 template<class C, class F>
73
74 template<class... Args>
75 using c_action_t = c_func_t<void(Args...)>;
76
77 template<class C, class... Args>
78 using c_member_action_t = c_member_func_t<C, void(Args...)>;
79
81
82 template<class C>
84 #pragma endregion
85
86} // namespace mstd
87 #endif
88#endif
#define _MSTD_HAS_CXX17
Definition config.hpp:45
#define _MSTD_CONSTEXPR17
Definition config.hpp:76
#define _MSTD_HAS_CXX20
Definition config.hpp:52
#define _MSTD_TYPENAME17
Definition config.hpp:82
Definition function_traits.hpp:23
Definition arithmetic_types.hpp:23
c_member_action_t< C > c_member_method_t
Definition functions_types.hpp:83
c_func_t< void(Args...)> c_action_t
Definition functions_types.hpp:75
static _MSTD_CONSTEXPR17 const bool is_action_v
Definition functions_types.hpp:29
func_t< void(Args...)> action_t
Definition functions_types.hpp:46
c_member_func_t< C, void(Args...)> c_member_action_t
Definition functions_types.hpp:78
as_std_function_t< F > func_t
Definition functions_types.hpp:43
_MSTD_TYPENAME17 utils::c_func_impl< F, void >::type c_func_t
Definition functions_types.hpp:69
_MSTD_TYPENAME17 utils::c_func_impl< F, C >::type c_member_func_t
Definition functions_types.hpp:72
static _MSTD_CONSTEXPR17 const bool is_function_v
Definition functions_types.hpp:25
action_t<> method_t
Definition functions_types.hpp:48
_MSTD_TYPENAME17 function_traits< F >::std_function_type as_std_function_t
Definition function_traits.hpp:608
static _MSTD_CONSTEXPR17 const bool is_method_v
Definition functions_types.hpp:32
Definition functions_types.hpp:55