39{
40 {
41
43
44 visitor2{ visitor },
45
47
48
50 }
51
52 {
53
56
58 constexpr auto f4 =
60
61 {
62 auto p1 = f1();
63 REQUIRE(p1->member == 0);
64 auto p2 = f2(1);
65 REQUIRE(p2->member == 1);
66
67
68 auto p3 = f4(2, move(p2));
69 REQUIRE(p3->member == 2);
70 REQUIRE(!p2);
71 }
72
73 {
74 auto p1 = f3();
75 REQUIRE(p1->member == 0);
76 auto p2 = f3(1);
77 REQUIRE(p2->member == 1);
78 }
79
80 TakesNonTypeParameter<f1> t1{};
81 TakesNonTypeParameter<f2> t2{};
82
83 }
84
85 {
86
89
91 constexpr auto f4 =
93
94 {
95 auto p1 = f1();
96 REQUIRE(p1->member == 0);
97 auto p2 = f2(1);
98 REQUIRE(p2->member == 1);
99
100
101 auto p3 = f4(2, move(p2));
102 REQUIRE(p3->member == 2);
103 REQUIRE(!p2);
104 }
105
106 {
107 auto p1 = f3();
108 REQUIRE(p1->member == 0);
109 auto p2 = f3(1);
110 REQUIRE(p2->member == 1);
111 }
112
113 TakesNonTypeParameter<f1> t1{};
114 TakesNonTypeParameter<f2> t2{};
115
116 }
117
118 {
119
122
124
125 REQUIRE(f1() == 0);
126 REQUIRE(f2(1) == 0);
127
128 REQUIRE(f3() == 0);
129 REQUIRE(f3(1) == 0);
130
131 TakesNonTypeParameter<f1> t1{};
132 TakesNonTypeParameter<f2> t2{};
133
134 }
135
136 {
137
138 constexpr auto f1 = UniqueMaker<X>();
139 constexpr auto f2 = UniqueMaker<X, int>();
140
142 constexpr auto f4 =
143 UniqueMaker<X, int, std::shared_ptr<X>>();
144
145 {
146 auto p1 = f1();
147 REQUIRE(p1->member == 0);
148 auto p2 = f2(1);
149 REQUIRE(p2->member == 1);
150
151
152 auto p3 = f4(2, move(p2));
153 REQUIRE(p3->member == 2);
154 REQUIRE(!p2);
155
156
157 auto p4 = f2({});
158
159 auto p5 = f1(0);
160 }
161
162 {
163 auto p1 = f3();
164 REQUIRE(p1->member == 0);
165 auto p2 = f3(1);
166 REQUIRE(p2->member == 1);
167 }
168
169
170 }
171}
Generates functions useable as non-type template parameters.
Generates functions useable as non-type template parameters.
Generates functions useable as non-type template parameters.