Lines Matching refs:opt
52 Opt opt; in test_one_arg() local
53 auto & v = opt.emplace(); in test_one_arg()
55 assert(static_cast<bool>(opt) == true); in test_one_arg()
56 assert(*opt == T(0)); in test_one_arg()
57 assert(&v == &*opt); in test_one_arg()
60 Opt opt; in test_one_arg() local
61 auto & v = opt.emplace(1); in test_one_arg()
63 assert(static_cast<bool>(opt) == true); in test_one_arg()
64 assert(*opt == T(1)); in test_one_arg()
65 assert(&v == &*opt); in test_one_arg()
68 Opt opt(2); in test_one_arg() local
69 auto & v = opt.emplace(); in test_one_arg()
71 assert(static_cast<bool>(opt) == true); in test_one_arg()
72 assert(*opt == T(0)); in test_one_arg()
73 assert(&v == &*opt); in test_one_arg()
76 Opt opt(2); in test_one_arg() local
77 auto & v = opt.emplace(1); in test_one_arg()
79 assert(static_cast<bool>(opt) == true); in test_one_arg()
80 assert(*opt == T(1)); in test_one_arg()
81 assert(&v == &*opt); in test_one_arg()
93 Opt opt; in test_multi_arg() local
94 auto &v = opt.emplace(101, 41); in test_multi_arg()
96 assert(static_cast<bool>(opt) == true); in test_multi_arg()
98 assert(*opt == T(101, 41)); in test_multi_arg()
101 Opt opt; in test_multi_arg() local
102 auto &v = opt.emplace({1, 2, 3, 4}); in test_multi_arg()
104 assert(static_cast<bool>(opt) == true); in test_multi_arg()
106 assert(*opt == T(4)); in test_multi_arg()
109 Opt opt; in test_multi_arg() local
110 auto &v = opt.emplace({1, 2, 3, 4, 5}, 6); in test_multi_arg()
112 assert(static_cast<bool>(opt) == true); in test_multi_arg()
114 assert(*opt == T(5)); // T sets its value to the size of the init list in test_multi_arg()
123 optional<T> opt; in test_on_test_type() local
127 auto &v = opt.emplace(); in test_on_test_type()
133 assert(static_cast<bool>(opt) == true); in test_on_test_type()
134 assert(*opt == T()); in test_on_test_type()
135 assert(&v == &*opt); in test_on_test_type()
139 auto &v = opt.emplace(); in test_on_test_type()
145 assert(static_cast<bool>(opt) == true); in test_on_test_type()
146 assert(*opt == T()); in test_on_test_type()
147 assert(&v == &*opt); in test_on_test_type()
151 auto &v = opt.emplace(101); in test_on_test_type()
157 assert(static_cast<bool>(opt) == true); in test_on_test_type()
158 assert(*opt == T(101)); in test_on_test_type()
159 assert(&v == &*opt); in test_on_test_type()
163 auto &v = opt.emplace(-10, 99); in test_on_test_type()
169 assert(static_cast<bool>(opt) == true); in test_on_test_type()
170 assert(*opt == T(-10, 99)); in test_on_test_type()
171 assert(&v == &*opt); in test_on_test_type()
175 auto &v = opt.emplace(-10, 99); in test_on_test_type()
181 assert(static_cast<bool>(opt) == true); in test_on_test_type()
182 assert(*opt == T(-10, 99)); in test_on_test_type()
183 assert(&v == &*opt); in test_on_test_type()
187 auto &v = opt.emplace({-10, 99, 42, 1}); in test_on_test_type()
193 assert(static_cast<bool>(opt) == true); in test_on_test_type()
194 assert(*opt == T(4)); // size of the initializer list in test_on_test_type()
195 assert(&v == &*opt); in test_on_test_type()
199 auto &v = opt.emplace({-10, 99, 42, 1}, 42); in test_on_test_type()
205 assert(static_cast<bool>(opt) == true); in test_on_test_type()
206 assert(*opt == T(4)); // size of the initializer list in test_on_test_type()
207 assert(&v == &*opt); in test_on_test_type()
213 optional<const int> opt; in test_empty_emplace() local
214 auto &v = opt.emplace(42); in test_empty_emplace()
216 assert(*opt == 42); in test_empty_emplace()
218 opt.emplace(); in test_empty_emplace()
219 assert(*opt == 0); in test_empty_emplace()
276 optional<Y> opt(y); in main() local
279 assert(static_cast<bool>(opt) == true); in main()
281 auto &v = opt.emplace(1); in main()
288 assert(static_cast<bool>(opt) == false); in main()