72 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// class std::ranges::lazy_split_view::outer-iterator::value_type;12 13#include <ranges>14 15#include <cassert>16#include <concepts>17#include "../types.h"18 19using V = ValueTypeForward;20static_assert(std::ranges::forward_range<V>);21static_assert(std::ranges::view<V>);22 23static_assert(std::is_base_of_v<std::ranges::view_interface<ValueTypeForward>, ValueTypeForward>);24 25constexpr bool test() {26 // empty()27 {28 {29 SplitViewForward v("abc def", " ");30 auto val = *v.begin();31 assert(!val.empty());32 }33 34 {35 SplitViewForward v;36 auto val = *v.begin();37 assert(val.empty());38 }39 }40 41 // operator bool()42 {43 {44 SplitViewForward v("abc def", " ");45 auto val = *v.begin();46 assert(val);47 }48 49 {50 SplitViewForward v;51 auto val = *v.begin();52 assert(!val);53 }54 }55 56 // front()57 {58 SplitViewForward v("abc def", " ");59 auto val = *v.begin();60 assert(val.front() == 'a');61 }62 63 return true;64}65 66int main(int, char**) {67 test();68 static_assert(test());69 70 return 0;71}72