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