xref: /llvm-project/libcxx/test/std/ranges/range.adaptors/range.zip/ctad.compile.pass.cpp (revision b8cb1dc9ea87faa8e8e9ab7a31710a8c0bb8b084)
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, c++20
10 
11 // template <class... Rs>
12 // zip_view(Rs&&...) -> zip_view<views::all_t<Rs>...>;
13 
14 #include <cassert>
15 #include <ranges>
16 #include <utility>
17 
18 struct Container {
19   int* begin() const;
20   int* end() const;
21 };
22 
23 struct View : std::ranges::view_base {
24   int* begin() const;
25   int* end() const;
26 };
27 
testCTAD()28 void testCTAD() {
29   static_assert(std::is_same_v<decltype(std::ranges::zip_view(Container{})),
30                                std::ranges::zip_view<std::ranges::owning_view<Container>>>);
31 
32   static_assert(std::is_same_v<decltype(std::ranges::zip_view(Container{}, View{})),
33                                std::ranges::zip_view<std::ranges::owning_view<Container>, View>>);
34 
35   Container c{};
36   static_assert(std::is_same_v<
37                 decltype(std::ranges::zip_view(Container{}, View{}, c)),
38                 std::ranges::zip_view<std::ranges::owning_view<Container>, View, std::ranges::ref_view<Container>>>);
39 }
40