Debian Codegraph @

libcxx/test/std/containers/sequences/list/list.capacity/empty.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 // <list>
10
11 // class list
12
13 // bool empty() const noexcept;
14
15 #include <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::list<int> C;
25 C c;
26 ASSERT_NOEXCEPT(c.empty());
27 assert(c.empty());
28 c.push_back(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::list<int, min_allocator<int>> C;
36 C c;
37 ASSERT_NOEXCEPT(c.empty());
38 assert(c.empty());
39 c.push_back(C::value_type(1));
40 assert(!c.empty());
41 c.clear();
42 assert(c.empty());
43 }
44 #endif
45
46 return 0;
47 }