2121#include " test_macros.h"
2222#include " test_iterators.h"
2323
24- struct gen_test {
25- TEST_CONSTEXPR int operator ()() const { return 1 ; }
24+ struct gen_test
25+ {
26+ TEST_CONSTEXPR int operator ()() const {return 1 ;}
2627};
2728
29+
2830#if TEST_STD_VER > 17
2931TEST_CONSTEXPR bool test_constexpr () {
30- int ia[] = {0 , 1 , 2 , 3 , 4 };
32+ int ia[] = {0 , 1 , 2 , 3 , 4 };
3133
32- std::generate (std::begin (ia), std::end (ia), gen_test ());
34+ std::generate (std::begin (ia), std::end (ia), gen_test ());
3335
34- return std::all_of (std::begin (ia), std::end (ia), [](int x) { return x == 1 ; });
35- }
36+ return std::all_of (std::begin (ia), std::end (ia), [](int x) { return x == 1 ; })
37+ ;
38+ }
3639#endif
3740
41+
3842template <class Iter >
39- void test () {
40- const unsigned n = 4 ;
41- int ia[n] = {0 };
42- std::generate (Iter (ia), Iter (ia + n), gen_test ());
43- assert (ia[0 ] == 1 );
44- assert (ia[1 ] == 1 );
45- assert (ia[2 ] == 1 );
46- assert (ia[3 ] == 1 );
43+ void
44+ test ()
45+ {
46+ const unsigned n = 4 ;
47+ int ia[n] = {0 };
48+ std::generate (Iter (ia), Iter (ia+n), gen_test ());
49+ assert (ia[0 ] == 1 );
50+ assert (ia[1 ] == 1 );
51+ assert (ia[2 ] == 1 );
52+ assert (ia[3 ] == 1 );
4753}
4854
4955void deque_test () {
@@ -55,15 +61,16 @@ void deque_test() {
5561 }
5662}
5763
58- int main (int , char **) {
59- test<forward_iterator<int *> >();
60- test<bidirectional_iterator<int *> >();
61- test<random_access_iterator<int *> >();
62- test<int *>();
63- deque_test ();
64+ int main (int , char **)
65+ {
66+ test<forward_iterator<int *> >();
67+ test<bidirectional_iterator<int *> >();
68+ test<random_access_iterator<int *> >();
69+ test<int *>();
70+ deque_test ();
6471
6572#if TEST_STD_VER > 17
66- static_assert (test_constexpr ());
73+ static_assert (test_constexpr ());
6774#endif
6875
6976 return 0 ;
0 commit comments