xref: /llvm-project/libcxx/test/std/ranges/range.adaptors/range.split/iterator/ctor.default.pass.cpp (revision a2b3ab8f7786b9bb6e1b8bbb01b88d4bbe28af69)
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // UNSUPPORTED: c++03, c++11, c++14, c++17
10 
11 // iterator() = default;
12 
13 #include <cassert>
14 #include <ranges>
15 
16 #include "../types.h"
17 
18 struct PODIter : ForwardIterBase<PODIter> {
19   int i;
20 };
21 
test()22 constexpr bool test() {
23   using SplitView = std::ranges::split_view<std::ranges::subrange<PODIter>, std::ranges::subrange<PODIter>>;
24   using SplitIter = std::ranges::iterator_t<SplitView>;
25   {
26     SplitIter iter;
27     assert(iter.base().i == 0); // PODIter has to be initialised to have value 0
28   }
29 
30   {
31     SplitIter iter = {};        // explicit(false)
32     assert(iter.base().i == 0); // PODIter has to be initialised to have value 0
33   }
34 
35   return true;
36 }
37 
main(int,char **)38 int main(int, char**) {
39   test();
40   static_assert(test());
41 
42   return 0;
43 }
44