forked from github/codeql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcpp11_g.cpp
More file actions
39 lines (32 loc) · 756 Bytes
/
cpp11_g.cpp
File metadata and controls
39 lines (32 loc) · 756 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
32
33
34
35
36
37
38
39
template<typename T> T make_val_from_one() {
T val ({1});
return val;
}
template<typename T> T make_val_from_three_and_four() {
T val ({3,4});
return val;
}
template<typename ...Args> int count_args_1() {
return sizeof...(Args);
}
template<typename ...Args> int count_args_2(Args... a...) {
return sizeof...(a);
}
struct int_pair {
int first;
int second;
};
struct choose_second {
choose_second(int first, int second)
: value(second)
{
}
int value;
};
void numbers() {
int zero = count_args_1<>();
int one = make_val_from_one<int>();
int two = count_args_2(1, 1.);
int three = make_val_from_three_and_four<int_pair>().first;
int four = make_val_from_three_and_four<choose_second>().value;
}