Debian Codegraph @

libcxx/test/std/ranges/range.adaptors/range.drop/ctor.default.pass.cpp

raw
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 // drop_view() requires default_initializable<V> = default;
12
13 #include <ranges>
14
15 #include "test_macros.h"
16 #include "types.h"
17
18 constexpr bool test() {
19 std::ranges::drop_view<MoveOnlyView> dropView1;
20 assert(std::ranges::begin(dropView1) == globalBuff);
21
22 static_assert( std::is_default_constructible_v<std::ranges::drop_view<ForwardView>>);
23 static_assert(!std::is_default_constructible_v<std::ranges::drop_view<NoDefaultCtorForwardView>>);
24
25 LIBCPP_STATIC_ASSERT( std::is_nothrow_default_constructible_v<std::ranges::drop_view<ForwardView>>);
26 static_assert(!std::is_nothrow_default_constructible_v<ThrowingDefaultCtorForwardView>);
27 static_assert(!std::is_nothrow_default_constructible_v<std::ranges::drop_view<ThrowingDefaultCtorForwardView>>);
28
29 return true;
30 }
31
32 int main(int, char**) {
33 test();
34 static_assert(test());
35
36 return 0;
37 }