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