File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77#include < iostream>
88#include < string>
99#include < vector>
10+ #include < set>
1011#include < map>
1112
13+ #include < signal.h>
14+
1215void case1 ()
1316{
1417
@@ -73,6 +76,37 @@ void case4()
7376}
7477
7578void case5 ()
79+ {
80+ int x = 0 ;
81+
82+ decltype (x) x1;
83+ decltype (x)& x2 = x;
84+ decltype (x)* x3;
85+ decltype (&x) x4;
86+ decltype (&x)* x5;
87+ decltype (x2) x6 = x2;
88+
89+ using int_ptr = decltype (&x);
90+ using int_ref = decltype (x)&;
91+ }
92+
93+ void case6 ()
94+ {
95+ int x = 0 ;
96+
97+ decltype (auto ) x1 = (x);
98+ decltype (auto ) x2 = &x;
99+ decltype (auto ) x3 = x1;
100+ }
101+
102+ auto get_a_set ()
103+ {
104+ std::set<int > s = {1 ,2 ,3 };
105+
106+ return s;
107+ }
108+
109+ void case7 ()
76110{
77111 using namespace std ;
78112
@@ -90,6 +124,19 @@ void case5()
90124 cout << endl;
91125}
92126
127+ class DemoClass final
128+ {
129+ public:
130+ using sig_func_ptr_t = decltype (&signal) ;
131+ public:
132+ using set_type = std::set<int >;
133+
134+ private:
135+ set_type m_set;
136+
137+ using iter_type = decltype (m_set.begin());
138+ iter_type m_pos;
139+ };
93140
94141int main ()
95142{
@@ -100,6 +147,8 @@ int main()
100147 case3 ();
101148 case4 ();
102149 case5 ();
150+ case6 ();
151+ case7 ();
103152
104153 cout << " auto/decltype demo" << endl;
105154}
You can’t perform that action at this time.
0 commit comments