-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
41 lines (27 loc) · 1.16 KB
/
main.cpp
File metadata and controls
41 lines (27 loc) · 1.16 KB
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
32
33
34
35
36
37
38
39
40
41
#include <iostream>
#include "func.h"
int f(int, int, int)
{
return 0;
}
void g()
{
}
void h(int, double, long, long double)
{
}
int main() {
static_assert(mpl::arity_of<decltype(f)>::value == 3, "arity is 3!");
static_assert(mpl::arity_of<decltype(g)>::value == 0, "arity is 0!");
std::cout << mpl::arity_of<decltype(f)>::value << "\n";
std::cout << mpl::arity_of<decltype(g)>::value << "\n";
static_assert(mpl::returns<void, decltype(g)>::value, "return type is void!");
static_assert(mpl::returns<int, decltype(f)>::value, "return type is int!");
static_assert(mpl::args_have_type<int, decltype(f)>::value, "args have int!");
static_assert(mpl::args_have_type<void, decltype(g)>::value, "args have void!");
std::cout << mpl::args_have_type<double, decltype(f)>::value << std::endl;
std::cout << mpl::has_arg_type<long double, decltype(h)>::value << std::endl;
std::cout << mpl::has_arg_type<bool, decltype(g)>::value << std::endl; // false
std::cout << mpl::has_arg_type<int, decltype(h)>::value << std::endl;
//std::cout << mpl::has_exact_arg_types<std::tuple<int, int, int>, decltype(f)>::value << std::endl;
}