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 // UNSUPPORTED: libcpp-has-no-incomplete-ranges
11 
12 // explicit outer-iterator::value_type::value_type(outer-iterator i)
13 
14 #include <ranges>
15 
16 #include <cassert>
17 #include "../types.h"
18 
19 // Verify that the constructor is `explicit`.
20 static_assert(!std::is_convertible_v<OuterIterForward, ValueTypeForward>);
21 static_assert(!std::is_convertible_v<OuterIterInput, ValueTypeInput>);
22 
test()23 constexpr bool test() {
24   // `View` is a forward range.
25   {
26     CopyableView input = "a";
27     SplitViewCopyable v(input, "b");
28     ValueTypeCopyable val(v.begin());
29     assert(val.begin().base() == input.begin());
30   }
31 
32   // `View` is an input range.
33   {
34     InputView input = "a";
35     SplitViewInput v(input, 'b');
36     ValueTypeInput val(v.begin());
37     assert(*val.begin().base() == *input.begin());
38   }
39 
40   return true;
41 }
42 
main(int,char **)43 int main(int, char**) {
44   test();
45   static_assert(test());
46 
47   return 0;
48 }
49