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-no-concepts 11 // UNSUPPORTED: libcpp-has-no-incomplete-ranges 12 13 // constexpr explicit join_view(V base); 14 15 #include <cassert> 16 #include <ranges> 17 18 #include "test_macros.h" 19 #include "types.h" 20 21 constexpr bool test() { 22 int buffer[4][4] = {{1111, 2222, 3333, 4444}, {555, 666, 777, 888}, {99, 1010, 1111, 1212}, {13, 14, 15, 16}}; 23 24 { 25 ChildView children[4] = {ChildView(buffer[0]), ChildView(buffer[1]), ChildView(buffer[2]), ChildView(buffer[3])}; 26 auto jv = std::ranges::join_view(ParentView{children}); 27 assert(std::move(jv).base().ptr_ == children); 28 } 29 30 { 31 std::ranges::join_view jv(buffer); 32 assert(jv.base().base() == buffer + 0); 33 } 34 35 { 36 // Test explicitness. 37 static_assert( std::is_constructible_v<std::ranges::join_view<ParentView<ChildView>>, ParentView<ChildView>>); 38 static_assert(!std::is_convertible_v<std::ranges::join_view<ParentView<ChildView>>, ParentView<ChildView>>); 39 } 40 41 return true; 42 } 43 44 int main(int, char**) { 45 test(); 46 static_assert(test()); 47 48 return 0; 49 } 50