• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (C) 2019 T. Zachary Laine
2 //
3 // Distributed under the Boost Software License, Version 1.0. (See
4 // accompanying file LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
6 #include "../example/static_vector.hpp"
7 
8 #include "ill_formed.hpp"
9 
10 #include <boost/core/lightweight_test.hpp>
11 
12 #include <array>
13 
14 // Instantiate all the members we can.
15 template struct static_vector<int, 1024>;
16 
17 using vec_type = static_vector<int, 10>;
18 
19 
test_default_ctor()20 void test_default_ctor()
21 {
22     vec_type v;
23     BOOST_TEST(v.empty());
24     BOOST_TEST(v.size() == 0u);
25 
26     BOOST_TEST(v.max_size() == 10u);
27     BOOST_TEST(v.capacity() == 10u);
28 
29     BOOST_TEST(v == v);
30     BOOST_TEST(v <= v);
31     BOOST_TEST(v >= v);
32 
33     BOOST_TEST_THROWS(v.at(0), std::out_of_range);
34 
35     vec_type const & cv = v;
36     BOOST_TEST(cv.empty());
37     BOOST_TEST(cv.size() == 0u);
38 
39     BOOST_TEST(cv.max_size() == 10u);
40     BOOST_TEST(cv.capacity() == 10u);
41 
42     BOOST_TEST(cv == cv);
43     BOOST_TEST(cv <= cv);
44     BOOST_TEST(cv >= cv);
45 
46     BOOST_TEST_THROWS(cv.at(0), std::out_of_range);
47 }
48 
49 
test_other_ctors_assign_ctor()50 void test_other_ctors_assign_ctor()
51 {
52     {
53         vec_type v(3);
54         BOOST_TEST(!v.empty());
55         BOOST_TEST(v.size() == 3u);
56 
57         vec_type v2(std::initializer_list<int>{0, 0, 0});
58         BOOST_TEST(v == v2);
59     }
60 
61     {
62         std::initializer_list<int> il{3, 2, 1};
63         vec_type v(il);
64         BOOST_TEST(!v.empty());
65         BOOST_TEST(v.size() == 3u);
66 
67         static_assert(std::is_same<decltype(v = il), vec_type &>::value, "");
68 
69         vec_type v2;
70         v2 = il;
71         BOOST_TEST(v == v2);
72     }
73 
74     {
75         std::initializer_list<int> il{3, 2, 1};
76         vec_type v;
77         v.assign(il);
78         BOOST_TEST(!v.empty());
79         BOOST_TEST(v.size() == 3u);
80 
81         static_assert(std::is_same<decltype(v.assign(il)), void>::value, "");
82 
83         vec_type v2;
84         v2 = il;
85         BOOST_TEST(v == v2);
86     }
87 
88     {
89         vec_type v(3, 4);
90         BOOST_TEST(!v.empty());
91         BOOST_TEST(v.size() == 3u);
92 
93         vec_type v2 = {4, 4, 4};
94         BOOST_TEST(v == v2);
95     }
96 
97     {
98         vec_type v;
99         v.assign(3, 4);
100         BOOST_TEST(!v.empty());
101         BOOST_TEST(v.size() == 3u);
102 
103         static_assert(std::is_same<decltype(v.assign(3, 4)), void>::value, "");
104 
105         vec_type v2 = {4, 4, 4};
106         BOOST_TEST(v == v2);
107     }
108 
109     {
110         std::array<int, 3> a = {{1, 2, 3}};
111 
112         vec_type v(a.begin(), a.end());
113         BOOST_TEST(!v.empty());
114         BOOST_TEST(v.size() == 3u);
115 
116         vec_type v2 = {1, 2, 3};
117         BOOST_TEST(v == v2);
118     }
119 
120     {
121         std::array<int, 3> a = {{1, 2, 3}};
122 
123         vec_type v;
124         v.assign(a.begin(), a.end());
125         BOOST_TEST(!v.empty());
126         BOOST_TEST(v.size() == 3u);
127 
128         static_assert(
129             std::is_same<decltype(v.assign(a.begin(), a.end())), void>::value,
130             "");
131 
132         vec_type v2 = {1, 2, 3};
133         BOOST_TEST(v == v2);
134     }
135 }
136 
137 
test_resize()138 void test_resize()
139 {
140     {
141         vec_type v;
142 
143         static_assert(std::is_same<decltype(v.resize(1)), void>::value, "");
144 
145         v.resize(3);
146         BOOST_TEST(v == vec_type(3));
147 
148         v.resize(6);
149         BOOST_TEST(v == vec_type(6));
150     }
151 
152     {
153         vec_type v(6);
154 
155         v.resize(3);
156         BOOST_TEST(v == vec_type(3));
157 
158         v.resize(0);
159         BOOST_TEST(v == vec_type{});
160     }
161 }
162 
163 
test_assignment_copy_move_equality()164 void test_assignment_copy_move_equality()
165 {
166     {
167         vec_type v2 = {4, 4, 4};
168 
169         vec_type v(v2);
170         BOOST_TEST(v == v2);
171     }
172 
173     {
174         vec_type v;
175         vec_type v2 = {4, 4, 4};
176 
177         static_assert(std::is_same<decltype(v = v2), vec_type &>::value, "");
178         static_assert(
179             std::is_same<decltype(v = std::move(v2)), vec_type &>::value, "");
180 
181         v = v2;
182         BOOST_TEST(v == v2);
183     }
184 
185     {
186         vec_type v2 = {4, 4, 4};
187 
188         vec_type v(std::move(v2));
189         BOOST_TEST(v == (vec_type(3, 4)));
190         BOOST_TEST(v2.empty());
191     }
192 
193     {
194         vec_type v;
195         vec_type v2 = {4, 4, 4};
196 
197         v = std::move(v2);
198         BOOST_TEST(v == (vec_type(3, 4)));
199         BOOST_TEST(v2.empty());
200     }
201 }
202 
203 
test_comparisons()204 void test_comparisons()
205 {
206     vec_type sm = {1, 2, 3};
207     vec_type md = {1, 2, 3, 4};
208     vec_type lg = {1, 2, 3, 4, 5};
209 
210     BOOST_TEST(sm == sm);
211     BOOST_TEST(!(sm == md));
212     BOOST_TEST(!(sm == lg));
213 
214     BOOST_TEST(!(sm != sm));
215     BOOST_TEST(sm != md);
216     BOOST_TEST(sm != lg);
217 
218     BOOST_TEST(!(sm < sm));
219     BOOST_TEST(sm < md);
220     BOOST_TEST(sm < lg);
221 
222     BOOST_TEST(sm <= sm);
223     BOOST_TEST(sm <= md);
224     BOOST_TEST(sm <= lg);
225 
226     BOOST_TEST(!(sm > sm));
227     BOOST_TEST(!(sm > md));
228     BOOST_TEST(!(sm > lg));
229 
230     BOOST_TEST(sm >= sm);
231     BOOST_TEST(!(sm >= md));
232     BOOST_TEST(!(sm >= lg));
233 
234 
235     BOOST_TEST(!(md == sm));
236     BOOST_TEST(md == md);
237     BOOST_TEST(!(md == lg));
238 
239     BOOST_TEST(!(md < sm));
240     BOOST_TEST(!(md < md));
241     BOOST_TEST(md < lg);
242 
243     BOOST_TEST(!(md <= sm));
244     BOOST_TEST(md <= md);
245     BOOST_TEST(md <= lg);
246 
247     BOOST_TEST(md > sm);
248     BOOST_TEST(!(md > md));
249     BOOST_TEST(!(md > lg));
250 
251     BOOST_TEST(md >= sm);
252     BOOST_TEST(md >= md);
253     BOOST_TEST(!(md >= lg));
254 
255 
256     BOOST_TEST(!(lg == sm));
257     BOOST_TEST(!(lg == md));
258     BOOST_TEST(lg == lg);
259 
260     BOOST_TEST(!(lg < sm));
261     BOOST_TEST(!(lg < md));
262     BOOST_TEST(!(lg < lg));
263 
264     BOOST_TEST(!(lg <= sm));
265     BOOST_TEST(!(lg <= md));
266     BOOST_TEST(lg <= lg);
267 
268     BOOST_TEST(lg > sm);
269     BOOST_TEST(lg > md);
270     BOOST_TEST(!(lg > lg));
271 
272     BOOST_TEST(lg >= sm);
273     BOOST_TEST(lg >= md);
274     BOOST_TEST(lg >= lg);
275 }
276 
277 
test_swap()278 void test_swap()
279 {
280     {
281         vec_type v1(3, 4);
282         vec_type v2(4, 3);
283 
284         static_assert(std::is_same<decltype(v1.swap(v2)), void>::value, "");
285         static_assert(std::is_same<decltype(swap(v1, v2)), void>::value, "");
286 
287         v1.swap(v2);
288 
289         BOOST_TEST(v1.size() == 4u);
290         BOOST_TEST(v2.size() == 3u);
291 
292         BOOST_TEST(v1 == vec_type(4, 3));
293         BOOST_TEST(v2 == vec_type(3, 4));
294     }
295 
296     {
297         vec_type v1(3, 4);
298         vec_type v2(4, 3);
299 
300         swap(v1, v2);
301 
302         BOOST_TEST(v1.size() == 4u);
303         BOOST_TEST(v2.size() == 3u);
304 
305         BOOST_TEST(v1 == vec_type(4, 3));
306         BOOST_TEST(v2 == vec_type(3, 4));
307     }
308 }
309 
310 template<typename Iter>
311 using writable_iter_t = decltype(
312     *std::declval<Iter>() =
313         std::declval<typename std::iterator_traits<Iter>::value_type>());
314 
315 static_assert(
316     ill_formed<
317         writable_iter_t,
318         decltype(std::declval<vec_type const &>().begin())>::value,
319     "");
320 static_assert(
321     ill_formed<
322         writable_iter_t,
323         decltype(std::declval<vec_type const &>().end())>::value,
324     "");
325 static_assert(
326     ill_formed<writable_iter_t, decltype(std::declval<vec_type &>().cbegin())>::
327         value,
328     "");
329 static_assert(
330     ill_formed<writable_iter_t, decltype(std::declval<vec_type &>().cend())>::
331         value,
332     "");
333 
334 static_assert(
335     ill_formed<
336         writable_iter_t,
337         decltype(std::declval<vec_type const &>().rbegin())>::value,
338     "");
339 static_assert(
340     ill_formed<
341         writable_iter_t,
342         decltype(std::declval<vec_type const &>().rend())>::value,
343     "");
344 static_assert(
345     ill_formed<
346         writable_iter_t,
347         decltype(std::declval<vec_type &>().crbegin())>::value,
348     "");
349 static_assert(
350     ill_formed<writable_iter_t, decltype(std::declval<vec_type &>().crend())>::
351         value,
352     "");
353 
test_iterators()354 void test_iterators()
355 {
356     {
357         vec_type v = {3, 2, 1};
358 
359         static_assert(
360             std::is_same<decltype(v.begin()), vec_type::iterator>::value, "");
361         static_assert(
362             std::is_same<decltype(v.end()), vec_type::iterator>::value, "");
363         static_assert(
364             std::is_same<decltype(v.cbegin()), vec_type::const_iterator>::value,
365             "");
366         static_assert(
367             std::is_same<decltype(v.cend()), vec_type::const_iterator>::value,
368             "");
369         static_assert(
370             std::is_same<decltype(v.rbegin()), vec_type::reverse_iterator>::
371                 value,
372             "");
373         static_assert(
374             std::is_same<decltype(v.rbegin()), vec_type::reverse_iterator>::
375                 value,
376             "");
377         static_assert(
378             std::is_same<
379                 decltype(v.crbegin()),
380                 vec_type::const_reverse_iterator>::value,
381             "");
382         static_assert(
383             std::is_same<
384                 decltype(v.crbegin()),
385                 vec_type::const_reverse_iterator>::value,
386             "");
387 
388         std::array<int, 3> const a = {{3, 2, 1}};
389 	std::array<int, 3> const ra = {{1, 2, 3}};
390 
391         BOOST_TEST(std::equal(v.begin(), v.end(), a.begin(), a.end()));
392         BOOST_TEST(std::equal(v.cbegin(), v.cend(), a.begin(), a.end()));
393 
394         BOOST_TEST(std::equal(v.rbegin(), v.rend(), ra.begin(), ra.end()));
395         BOOST_TEST(std::equal(v.crbegin(), v.crend(), ra.begin(), ra.end()));
396 
397         *v.begin() = 8;
398         *v.rbegin() = 9;
399         BOOST_TEST(v == vec_type({8, 2, 9}));
400     }
401 
402     {
403         vec_type const v = {3, 2, 1};
404 
405         static_assert(
406             std::is_same<decltype(v.begin()), vec_type::const_iterator>::value,
407             "");
408         static_assert(
409             std::is_same<decltype(v.end()), vec_type::const_iterator>::value,
410             "");
411         static_assert(
412             std::is_same<decltype(v.cbegin()), vec_type::const_iterator>::value,
413             "");
414         static_assert(
415             std::is_same<decltype(v.cend()), vec_type::const_iterator>::value,
416             "");
417         static_assert(
418             std::is_same<
419                 decltype(v.rbegin()),
420                 vec_type::const_reverse_iterator>::value,
421             "");
422         static_assert(
423             std::is_same<
424                 decltype(v.rbegin()),
425                 vec_type::const_reverse_iterator>::value,
426             "");
427         static_assert(
428             std::is_same<
429                 decltype(v.crbegin()),
430                 vec_type::const_reverse_iterator>::value,
431             "");
432         static_assert(
433             std::is_same<
434                 decltype(v.crbegin()),
435                 vec_type::const_reverse_iterator>::value,
436             "");
437 
438         std::array<int, 3> const a = {{3, 2, 1}};
439         std::array<int, 3> const ra = {{1, 2, 3}};
440 
441         BOOST_TEST(std::equal(v.begin(), v.end(), a.begin(), a.end()));
442         BOOST_TEST(std::equal(v.cbegin(), v.cend(), a.begin(), a.end()));
443 
444         BOOST_TEST(std::equal(v.rbegin(), v.rend(), ra.begin(), ra.end()));
445         BOOST_TEST(std::equal(v.crbegin(), v.crend(), ra.begin(), ra.end()));
446     }
447 }
448 
449 
test_emplace_insert()450 void test_emplace_insert()
451 {
452     {
453         vec_type v;
454 
455         int const i = 0;
456         static_assert(
457             std::is_same<decltype(v.emplace_back(0)), vec_type::reference>::
458                 value,
459             "");
460         static_assert(
461             std::is_same<decltype(v.emplace_back(i)), vec_type::reference>::
462                 value,
463             "");
464 
465         v.emplace_back(i);
466         BOOST_TEST(v.front() == i);
467         BOOST_TEST(v.back() == i);
468 
469         v.emplace_back(1);
470         BOOST_TEST(v.front() == i);
471         BOOST_TEST(v.back() == 1);
472 
473         v.emplace_back(2);
474         BOOST_TEST(v.front() == i);
475         BOOST_TEST(v.back() == 2);
476 
477         BOOST_TEST(v == vec_type({0, 1, 2}));
478     }
479 
480     {
481         vec_type v = {1, 2};
482 
483         int const i = 0;
484         static_assert(
485             std::is_same<
486                 decltype(v.emplace(v.begin(), 0)),
487                 vec_type::iterator>::value,
488             "");
489         static_assert(
490             std::is_same<
491                 decltype(v.emplace(v.begin(), i)),
492                 vec_type::iterator>::value,
493             "");
494 
495         v.emplace(v.begin(), i);
496         BOOST_TEST(v == vec_type({0, 1, 2}));
497 
498         v.emplace(v.end(), 3);
499         BOOST_TEST(v == vec_type({0, 1, 2, 3}));
500 
501         v.emplace(v.begin() + 2, 9);
502         BOOST_TEST(v == vec_type({0, 1, 9, 2, 3}));
503     }
504 
505     {
506         vec_type v = {1, 2};
507 
508         std::array<int, 2> a1 = {{0, 0}};
509         std::array<int, 1> a2 = {{3}};
510         std::array<int, 3> a3 = {{9, 9, 9}};
511 
512         static_assert(
513             std::is_same<
514                 decltype(v.insert(v.begin(), a1.begin(), a1.end())),
515                 vec_type::iterator>::value,
516             "");
517 
518         auto const it0 = v.insert(v.begin(), a1.begin(), a1.end());
519         BOOST_TEST(v == vec_type({0, 0, 1, 2}));
520         BOOST_TEST(it0 == v.begin());
521 
522         auto const it1 = v.insert(v.end(), a2.begin(), a2.end());
523         BOOST_TEST(v == vec_type({0, 0, 1, 2, 3}));
524         BOOST_TEST(it1 == v.begin() + 4);
525 
526         auto const it2 = v.insert(v.begin() + 2, a3.begin(), a3.end());
527         BOOST_TEST(v == vec_type({0, 0, 9, 9, 9, 1, 2, 3}));
528         BOOST_TEST(it2 == v.begin() + 2);
529     }
530 
531     {
532         vec_type v = {1, 2};
533 
534         int const i = 0;
535         static_assert(
536             std::is_same<decltype(v.insert(v.begin(), 0)), vec_type::iterator>::
537                 value,
538             "");
539         static_assert(
540             std::is_same<decltype(v.insert(v.begin(), i)), vec_type::iterator>::
541                 value,
542             "");
543 
544         v.insert(v.begin(), i);
545         BOOST_TEST(v == vec_type({0, 1, 2}));
546 
547         v.insert(v.end(), 3);
548         BOOST_TEST(v == vec_type({0, 1, 2, 3}));
549 
550         v.insert(v.begin() + 2, 9);
551         BOOST_TEST(v == vec_type({0, 1, 9, 2, 3}));
552     }
553 
554     {
555         vec_type v = {1, 2};
556 
557         static_assert(
558             std::is_same<
559                 decltype(v.insert(v.begin(), 3, 0)),
560                 vec_type::iterator>::value,
561             "");
562 
563         v.insert(v.begin(), 2, 0);
564         BOOST_TEST(v == vec_type({0, 0, 1, 2}));
565 
566         v.insert(v.end(), 1, 3);
567         BOOST_TEST(v == vec_type({0, 0, 1, 2, 3}));
568 
569         v.insert(v.begin() + 2, 3, 9);
570         BOOST_TEST(v == vec_type({0, 0, 9, 9, 9, 1, 2, 3}));
571     }
572 
573     {
574         vec_type v = {1, 2};
575 
576         static_assert(
577             std::is_same<
578                 decltype(v.insert(v.begin(), std::initializer_list<int>{0, 0})),
579                 vec_type::iterator>::value,
580             "");
581 
582         v.insert(v.begin(), std::initializer_list<int>{0, 0});
583         BOOST_TEST(v == vec_type({0, 0, 1, 2}));
584 
585         v.insert(v.end(), std::initializer_list<int>{3});
586         BOOST_TEST(v == vec_type({0, 0, 1, 2, 3}));
587 
588         v.insert(v.begin() + 2, std::initializer_list<int>{9, 9, 9});
589         BOOST_TEST(v == vec_type({0, 0, 9, 9, 9, 1, 2, 3}));
590     }
591 }
592 
593 
test_erase()594 void test_erase()
595 {
596     {
597         vec_type v = {3, 2, 1};
598 
599         static_assert(
600             std::is_same<
601                 decltype(v.erase(v.begin(), v.end())),
602                 vec_type::iterator>::value,
603             "");
604         static_assert(
605             std::is_same<decltype(v.erase(v.begin())), vec_type::iterator>::
606                 value,
607             "");
608 
609         v.erase(v.begin(), v.end());
610         BOOST_TEST(v.empty());
611         BOOST_TEST(v.size() == 0u);
612     }
613 
614     {
615         vec_type v = {3, 2, 1};
616         v.erase(v.begin() + 1, v.end());
617         BOOST_TEST(!v.empty());
618         BOOST_TEST(v.size() == 1u);
619         BOOST_TEST(v == vec_type(1, 3));
620     }
621 
622     {
623         vec_type v = {3, 2, 1};
624         v.erase(v.begin(), v.end() - 1);
625         BOOST_TEST(!v.empty());
626         BOOST_TEST(v.size() == 1u);
627         BOOST_TEST(v == vec_type(1, 1));
628     }
629 
630     {
631         vec_type v = {3, 2, 1};
632         v.erase(v.begin());
633         BOOST_TEST(!v.empty());
634         BOOST_TEST(v.size() == 2u);
635         BOOST_TEST(v == vec_type({2, 1}));
636     }
637 
638     {
639         vec_type v = {3, 2, 1};
640         v.erase(v.begin() + 1);
641         BOOST_TEST(!v.empty());
642         BOOST_TEST(v.size() == 2u);
643         BOOST_TEST(v == vec_type({3, 1}));
644     }
645 
646     {
647         vec_type v = {3, 2, 1};
648         v.erase(v.begin() + 2);
649         BOOST_TEST(!v.empty());
650         BOOST_TEST(v.size() == 2u);
651         BOOST_TEST(v == vec_type({3, 2}));
652     }
653 }
654 
655 template<
656     typename Container,
657     typename ValueType = typename Container::value_type>
658 using lvalue_push_front_t = decltype(
659     std::declval<Container &>().push_front(std::declval<ValueType const &>()));
660 template<
661     typename Container,
662     typename ValueType = typename Container::value_type>
663 using rvalue_push_front_t = decltype(std::declval<Container &>().push_front(0));
664 template<typename Container>
665 using pop_front_t = decltype(std::declval<Container &>().pop_front());
666 
667 static_assert(ill_formed<lvalue_push_front_t, vec_type>::value, "");
668 static_assert(ill_formed<rvalue_push_front_t, vec_type>::value, "");
669 static_assert(ill_formed<pop_front_t, vec_type>::value, "");
670 
test_front_back()671 void test_front_back()
672 {
673     {
674         vec_type v;
675 
676         int const i = 0;
677         static_assert(std::is_same<decltype(v.push_back(0)), void>::value, "");
678         static_assert(std::is_same<decltype(v.push_back(i)), void>::value, "");
679         static_assert(std::is_same<decltype(v.pop_back()), void>::value, "");
680 
681         v.push_back(i);
682         BOOST_TEST(v.front() == i);
683         BOOST_TEST(v.back() == i);
684 
685         v.push_back(1);
686         BOOST_TEST(v.front() == i);
687         BOOST_TEST(v.back() == 1);
688 
689         v.push_back(2);
690         BOOST_TEST(v.front() == i);
691         BOOST_TEST(v.back() == 2);
692 
693         static_assert(std::is_same<decltype(v.front()), int &>::value, "");
694         static_assert(std::is_same<decltype(v.back()), int &>::value, "");
695 
696         v.front() = 9;
697         v.back() = 8;
698         BOOST_TEST(v == vec_type({9, 1, 8}));
699 
700         v.pop_back();
701         BOOST_TEST(v == vec_type({9, 1}));
702     }
703 
704     {
705         vec_type const v = {3, 2, 1};
706         BOOST_TEST(v.front() == 3);
707         BOOST_TEST(v.back() == 1);
708 
709         static_assert(
710             std::is_same<decltype(v.front()), int const &>::value, "");
711         static_assert(std::is_same<decltype(v.back()), int const &>::value, "");
712     }
713 }
714 
715 
test_data_index_at()716 void test_data_index_at()
717 {
718     {
719         vec_type v = {3, 2, 1};
720         BOOST_TEST(v.data()[0] == 3);
721         BOOST_TEST(v.data()[1] == 2);
722         BOOST_TEST(v.data()[2] == 1);
723         BOOST_TEST(v[0] == 3);
724         BOOST_TEST(v[1] == 2);
725         BOOST_TEST(v[2] == 1);
726         BOOST_TEST_NO_THROW(v.at(0));
727         BOOST_TEST_NO_THROW(v.at(1));
728         BOOST_TEST_NO_THROW(v.at(2));
729         BOOST_TEST_THROWS(v.at(3), std::out_of_range);
730 
731         static_assert(std::is_same<decltype(v.data()), int *>::value, "");
732         static_assert(std::is_same<decltype(v[0]), int &>::value, "");
733         static_assert(std::is_same<decltype(v.at(0)), int &>::value, "");
734 
735         v[0] = 8;
736         v.at(1) = 9;
737         BOOST_TEST(v == vec_type({8, 9, 1}));
738     }
739 
740     {
741         vec_type const v = {3, 2, 1};
742         BOOST_TEST(v.data()[0] == 3);
743         BOOST_TEST(v.data()[1] == 2);
744         BOOST_TEST(v.data()[2] == 1);
745         BOOST_TEST(v[0] == 3);
746         BOOST_TEST(v[1] == 2);
747         BOOST_TEST(v[2] == 1);
748         BOOST_TEST_NO_THROW(v.at(0));
749         BOOST_TEST_NO_THROW(v.at(1));
750         BOOST_TEST_NO_THROW(v.at(2));
751         BOOST_TEST_THROWS(v.at(3), std::out_of_range);
752 
753         static_assert(std::is_same<decltype(v.data()), int const *>::value, "");
754         static_assert(std::is_same<decltype(v[0]), int const &>::value, "");
755         static_assert(std::is_same<decltype(v.at(0)), int const &>::value, "");
756     }
757 }
758 
main()759 int main()
760 {
761     test_default_ctor();
762     test_other_ctors_assign_ctor();
763     test_resize();
764     test_assignment_copy_move_equality();
765     test_comparisons();
766     test_swap();
767     test_iterators();
768     test_emplace_insert();
769     test_erase();
770     test_front_back();
771     test_data_index_at();
772     return boost::report_errors();
773 }
774