-
Notifications
You must be signed in to change notification settings - Fork 10.8k
/
main.cpp
132 lines (115 loc) · 2.1 KB
/
main.cpp
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#include <stdio.h>
#include <stdint.h>
namespace a {
class c {
public:
c();
~c();
void func1()
{
puts (__PRETTY_FUNCTION__);
}
void func2()
{
puts (__PRETTY_FUNCTION__);
}
void func3()
{
puts (__PRETTY_FUNCTION__);
}
};
c::c() {}
c::~c() {}
}
namespace aa {
class cc {
public:
cc();
~cc();
void func1()
{
puts (__PRETTY_FUNCTION__);
}
void func2()
{
puts (__PRETTY_FUNCTION__);
}
void func3()
{
puts (__PRETTY_FUNCTION__);
}
};
cc::cc() {}
cc::~cc() {}
}
namespace b {
class c {
public:
c();
~c();
void func1()
{
puts (__PRETTY_FUNCTION__);
}
void func3()
{
puts (__PRETTY_FUNCTION__);
}
};
c::c() {}
c::~c() {}
}
namespace c {
class d {
public:
d () {}
~d() {}
void func2()
{
puts (__PRETTY_FUNCTION__);
}
void func3()
{
puts (__PRETTY_FUNCTION__);
}
};
}
namespace ns {
template <typename Type> struct Foo {
template <typename T> void import() {}
template <typename T> auto func() {}
operator bool() { return true; }
template <typename T> operator T() { return {}; }
template <typename T> void operator<<(T t) {}
};
template <typename Type> void g() {}
} // namespace ns
int main (int argc, char const *argv[])
{
a::c ac;
aa::cc aac;
b::c bc;
c::d cd;
ac.func1();
ac.func2();
ac.func3();
aac.func1();
aac.func2();
aac.func3();
bc.func1();
bc.func3();
cd.func2();
cd.func3();
ns::Foo<double> f;
f.import <int>();
f.func<int>();
f.func<ns::Foo<int>>();
f.operator bool();
f.operator a::c();
f.operator ns::Foo<int>();
f.operator<<(5);
f.operator<< <ns::Foo<int>>({});
ns::g<int>();
ns::g<char>();
return 0;
}