68 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9// UNSUPPORTED: c++03, c++11, c++14, c++1710 11// std::ranges::lazy_split_view::outer-iterator::value_type::begin()12 13#include <ranges>14 15#include <cassert>16#include "../types.h"17 18constexpr bool test() {19 // `View` is a forward range.20 {21 CopyableView input("a");22 23 // Non-const.24 {25 SplitViewCopyable v(input, "b");26 auto val = *v.begin();27 assert(val.begin().base() == input.begin());28 }29 30 // Const.31 {32 SplitViewCopyable v(input, "b");33 const auto val = *v.begin();34 assert(val.begin().base() == input.begin());35 }36 }37 38 // `View` is an input range.39 {40 InputView input("a");41 42 // Non-const.43 {44 SplitViewInput v(input, 'b');45 auto val = *v.begin();46 // Copies of `InputView` are independent and the iterators won't compare the same.47 assert(*val.begin().base() == *input.begin());48 }49 50 // Const.51 {52 SplitViewInput v(input, 'b');53 const auto val = *v.begin();54 // Copies of `InputView` are independent and the iterators won't compare the same.55 assert(*val.begin().base() == *input.begin());56 }57 }58 59 return true;60}61 62int main(int, char**) {63 assert(test());64 static_assert(test());65 66 return 0;67}68