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 | // <forward_list> |
10 | |
11 | // class forward_list |
12 | |
13 | // bool empty() const noexcept; |
14 | |
15 | #include <forward_list> |
16 | #include <cassert> |
17 | |
18 | #include "test_macros.h" |
19 | #include "min_allocator.h" |
20 | |
21 | int main(int, char**) |
22 | { |
23 | { |
24 | typedef std::forward_list<int> C; |
25 | C c; |
26 | ASSERT_NOEXCEPT(c.empty()); |
27 | assert(c.empty()); |
28 | c.push_front(val: C::value_type(1)); |
29 | assert(!c.empty()); |
30 | c.clear(); |
31 | assert(c.empty()); |
32 | } |
33 | #if TEST_STD_VER >= 11 |
34 | { |
35 | typedef std::forward_list<int, min_allocator<int>> C; |
36 | C c; |
37 | ASSERT_NOEXCEPT(c.empty()); |
38 | assert(c.empty()); |
39 | c.push_front(C::value_type(1)); |
40 | assert(!c.empty()); |
41 | c.clear(); |
42 | assert(c.empty()); |
43 | } |
44 | #endif |
45 | |
46 | return 0; |
47 | } |
48 | |