Embedded Template Library
1.0
Loading...
Searching...
No Matches
function_traits.h
Go to the documentation of this file.
1
2
3
/******************************************************************************
4
The MIT License(MIT)
5
6
Embedded Template Library.
7
https://github.com/ETLCPP/etl
8
https://www.etlcpp.com
9
10
Copyright(c) 2025 John Wellbelove
11
12
Permission is hereby granted, free of charge, to any person obtaining a copy
13
of this software and associated documentation files(the "Software"), to deal
14
in the Software without restriction, including without limitation the rights
15
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
16
copies of the Software, and to permit persons to whom the Software is
17
furnished to do so, subject to the following conditions :
18
19
The above copyright notice and this permission notice shall be included in all
20
copies or substantial portions of the Software.
21
22
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
25
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
SOFTWARE.
29
******************************************************************************/
30
31
#ifndef ETL_FUNCTION_TRAITS_INCLUDED
32
#define ETL_FUNCTION_TRAITS_INCLUDED
33
34
#include "
platform.h
"
35
#include "type_list.h"
36
#include "
type_traits.h
"
37
38
#if ETL_USING_CPP11
39
namespace
etl
40
{
41
//***************************************************************************
43
//***************************************************************************
44
template
<
typename
T>
45
struct
function_traits
;
46
47
//***************************************************************************
49
//***************************************************************************
50
template
<
typename
TReturn
,
typename
...
TArgs
>
51
struct
function_traits
<
TReturn
(*)(
TArgs
...)>
52
{
53
using
function_type =
TReturn
(
TArgs
...);
54
using
return_type =
TReturn
;
55
using
object_type =
void
;
56
using
argument_types
=
etl::type_list
<
TArgs
...>;
57
58
static
constexpr
bool
is_function
=
true
;
59
static
constexpr
bool
is_member_function
=
false
;
60
static
constexpr
bool
is_const =
false
;
61
static
constexpr
size_t
argument_count
=
sizeof
...(TArgs);
62
};
63
64
template
<
typename
TReturn
,
typename
...
TArgs
>
65
constexpr
bool
function_traits
<
TReturn
(*)(
TArgs
...)>
::is_function
;
66
67
template
<
typename
TReturn
,
typename
...
TArgs
>
68
constexpr
bool
function_traits
<
TReturn
(*)(
TArgs
...)>
::is_member_function
;
69
70
template
<
typename
TReturn
,
typename
...
TArgs
>
71
constexpr
bool
function_traits
<
TReturn
(*)(
TArgs
...)>::is_const;
72
73
template
<
typename
TReturn
,
typename
...
TArgs
>
74
constexpr
size_t
function_traits
<
TReturn
(*)(
TArgs
...)>
::argument_count
;
75
76
//***************************************************************************
78
//***************************************************************************
79
template
<
typename
TReturn
,
typename
TObject
,
typename
...
TArgs
>
80
struct
function_traits
<
TReturn
(
TObject
::*)(TArgs...)>
81
{
82
using
function_type =
TReturn
(
TArgs
...);
83
using
return_type =
TReturn
;
84
using
object_type =
TObject
;
85
using
argument_types
=
etl::type_list
<
TArgs
...>;
86
87
static
constexpr
bool
is_function
=
false
;
88
static
constexpr
bool
is_member_function
=
true
;
89
static
constexpr
bool
is_const =
false
;
90
static
constexpr
size_t
argument_count
=
sizeof
...(TArgs);
91
};
92
93
template
<
typename
TReturn
,
typename
TObject
,
typename
...
TArgs
>
94
constexpr
bool
function_traits
<
TReturn
(
TObject
::*)(
TArgs
...)>::
is_function
;
95
96
template
<
typename
TReturn
,
typename
TObject
,
typename
...
TArgs
>
97
constexpr
bool
function_traits
<
TReturn
(
TObject
::*)(
TArgs
...)>::
is_member_function
;
98
99
template
<
typename
TReturn
,
typename
TObject
,
typename
...
TArgs
>
100
constexpr
bool
function_traits
<
TReturn
(
TObject
::*)(
TArgs
...)>::is_const;
101
102
template
<
typename
TReturn
,
typename
TObject
,
typename
...
TArgs
>
103
constexpr
size_t
function_traits
<
TReturn
(
TObject
::*)(
TArgs
...)>::
argument_count
;
104
105
//***************************************************************************
107
//***************************************************************************
108
template
<
typename
TReturn
,
typename
TObject
,
typename
...
TArgs
>
109
struct
function_traits
<
TReturn
(
TObject
::*)(TArgs...)
const
>
110
{
111
using
function_type =
TReturn
(
TArgs
...);
112
using
return_type =
TReturn
;
113
using
object_type =
TObject
;
114
using
argument_types
=
etl::type_list
<
TArgs
...>;
115
116
static
constexpr
bool
is_function
=
false
;
117
static
constexpr
bool
is_member_function
=
true
;
118
static
constexpr
bool
is_const =
true
;
119
static
constexpr
size_t
argument_count
=
sizeof
...(TArgs);
120
};
121
122
template
<
typename
TReturn
,
typename
TObject
,
typename
...
TArgs
>
123
constexpr
bool
function_traits
<
TReturn
(
TObject
::*)(
TArgs
...)
const
>::
is_function
;
124
125
template
<
typename
TReturn
,
typename
TObject
,
typename
...
TArgs
>
126
constexpr
bool
function_traits
<
TReturn
(
TObject
::*)(
TArgs
...)
const
>::
is_member_function
;
127
128
template
<
typename
TReturn
,
typename
TObject
,
typename
...
TArgs
>
129
constexpr
bool
function_traits
<
TReturn
(
TObject
::*)(
TArgs
...)
const
>::is_const;
130
131
template
<
typename
TReturn
,
typename
TObject
,
typename
...
TArgs
>
132
constexpr
size_t
function_traits
<
TReturn
(
TObject
::*)(
TArgs
...)
const
>::
argument_count
;
133
}
134
#endif
135
136
#endif
etl
bitset_ext
Definition
absolute.h:38
etl::round_half_even_unscaled
ETL_NODISCARD ETL_CONSTEXPR14 T round_half_even_unscaled(T value) ETL_NOEXCEPT
Definition
scaled_rounding.h:314
platform.h
type_traits.h
include
etl
function_traits.h
Generated on Fri Aug 15 2025 20:22:09 for Embedded Template Library by
1.9.8