-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathis_function.h
More file actions
31 lines (23 loc) · 764 Bytes
/
is_function.h
File metadata and controls
31 lines (23 loc) · 764 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#pragma once
namespace func_traits
{
template <bool C>
struct bool_constant
{
static constexpr bool value = C;
};
struct true_type : bool_constant<true> {};
struct false_type : bool_constant<false> {};
template <typename>
struct is_function : false_type {};
template <typename F, typename... Args>
struct is_function<F(Args...)> : true_type {};
template <typename F, typename... Args>
struct is_function<F(*)(Args...)> : true_type {};
template <typename F, typename C, typename... Args>
struct is_function<F(C::*)(Args...)> : true_type {};
template <typename F, typename C, typename... Args>
struct is_function<F(C::*)(Args...) const> : true_type {};
template <typename F>
inline constexpr bool is_function_v = is_function<F>::value;
}