[RISCV] Use _B* suffix for vector mask logic pseudo instructions. (#119787)
[llvm-project.git] / libcxx / test / std / ranges / range.factories / range.repeat.view / ctor.value.bound.pass.cpp
blob733729f26f0a112f4b34bc0e4c3c5f01c669564a
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 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
11 // constexpr explicit repeat_view(const T& value, Bound bound = Bound()) requires copy_constructible<T>;
12 // constexpr explicit repeat_view(T&& value, Bound bound = Bound());
14 #include <ranges>
15 #include <cassert>
16 #include <iterator>
17 #include <type_traits>
19 #include "MoveOnly.h"
21 struct Empty {};
23 // Test explicit
24 static_assert(std::is_constructible_v<std::ranges::repeat_view<Empty>, const Empty&>);
25 static_assert(std::is_constructible_v<std::ranges::repeat_view<Empty>, Empty&&>);
26 static_assert(std::is_constructible_v<std::ranges::repeat_view<Empty, int>, const Empty&>);
27 static_assert(std::is_constructible_v<std::ranges::repeat_view<Empty, int>, Empty&&>);
29 static_assert(!std::is_convertible_v<const Empty&, std::ranges::repeat_view<Empty>>);
30 static_assert(!std::is_convertible_v<Empty&&, std::ranges::repeat_view<Empty>>);
31 static_assert(!std::is_convertible_v<const Empty&, std::ranges::repeat_view<Empty, int>>);
32 static_assert(!std::is_convertible_v<Empty&&, std::ranges::repeat_view<Empty, int>>);
34 static_assert(!std::is_constructible_v<std::ranges::repeat_view<MoveOnly>, const MoveOnly&>);
35 static_assert(std::is_constructible_v<std::ranges::repeat_view<MoveOnly>, MoveOnly&&>);
37 constexpr bool test() {
38 // Move && unbound && default argument
40 std::ranges::repeat_view<Empty> rv(Empty{});
41 assert(rv.begin() + 10 != rv.end());
44 // Move && unbound && user-provided argument
46 std::ranges::repeat_view<Empty> rv(Empty{}, std::unreachable_sentinel);
47 assert(rv.begin() + 10 != rv.end());
50 // Move && bound && default argument
52 std::ranges::repeat_view<Empty, int> rv(Empty{});
53 assert(rv.begin() == rv.end());
56 // Move && bound && user-provided argument
58 std::ranges::repeat_view<Empty, int> rv(Empty{}, 10);
59 assert(rv.begin() + 10 == rv.end());
62 // Copy && unbound && default argument
64 Empty e;
65 std::ranges::repeat_view<Empty> rv(e);
66 assert(rv.begin() + 10 != rv.end());
69 // Copy && unbound && user-provided argument
71 Empty e;
72 std::ranges::repeat_view<Empty> rv(e, std::unreachable_sentinel);
73 assert(rv.begin() + 10 != rv.end());
76 // Copy && bound && default argument
78 Empty e;
79 std::ranges::repeat_view<Empty, int> rv(e);
80 assert(rv.begin() == rv.end());
83 // Copy && bound && user-provided argument
85 Empty e;
86 std::ranges::repeat_view<Empty, int> rv(e, 10);
87 assert(rv.begin() + 10 == rv.end());
90 return true;
93 int main(int, char**) {
94 test();
95 static_assert(test());
97 return 0;