xref: /llvm-project/libcxx/test/std/ranges/range.req/range.view/view.subsumption.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
10 
11 // <ranges>
12 
13 // template<class T>
14 // concept view = ...;
15 
16 #include <ranges>
17 
18 #include "test_macros.h"
19 
20 struct View : std::ranges::view_base {
21   View() = default;
22   View(View&&) = default;
23   View& operator=(View&&) = default;
24   friend int* begin(View&);
25   friend int* begin(View const&);
26   friend int* end(View&);
27   friend int* end(View const&);
28 };
29 
30 namespace subsume_range {
31   template <std::ranges::view>
test()32   constexpr bool test() { return true; }
33   template <std::ranges::range>
test()34   constexpr bool test() { return false; }
35   static_assert(test<View>());
36 }
37 
38 namespace subsume_movable {
39   template <std::ranges::view>
test()40   constexpr bool test() { return true; }
41   template <std::movable>
test()42   constexpr bool test() { return false; }
43   static_assert(test<View>());
44 }
45