39 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// REQUIRES: std-at-least-c++2310 11// <ranges>12 13// class join_with_view : public view_interface<join_with_view<V, Pattern>>14 15#include <ranges>16 17#include <concepts>18#include <string>19#include <vector>20 21template <class T>22struct View : std::ranges::view_base {23 std::vector<T>* begin();24 std::vector<T>* end();25};26 27template <class T>28struct Pattern : std::ranges::view_base {29 T* begin();30 T* end();31};32 33template <class T>34using JoinWithView = std::ranges::join_with_view<View<T>, Pattern<T>>;35 36static_assert(std::derived_from<JoinWithView<int>, std::ranges::view_interface<JoinWithView<int>>>);37static_assert(std::derived_from<JoinWithView<void*>, std::ranges::view_interface<JoinWithView<void*>>>);38static_assert(std::derived_from<JoinWithView<std::string>, std::ranges::view_interface<JoinWithView<std::string>>>);39