• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 // <forward_list>
11 
12 // class forward_list
13 
14 // bool empty() const noexcept;
15 
16 #include <forward_list>
17 #include <cassert>
18 
19 #include "test_macros.h"
20 #include "min_allocator.h"
21 
main()22 int main()
23 {
24     {
25     typedef std::forward_list<int> C;
26     C c;
27     ASSERT_NOEXCEPT(c.empty());
28     assert(c.empty());
29     c.push_front(C::value_type(1));
30     assert(!c.empty());
31     c.clear();
32     assert(c.empty());
33     }
34 #if TEST_STD_VER >= 11
35     {
36     typedef std::forward_list<int, min_allocator<int>> C;
37     C c;
38     ASSERT_NOEXCEPT(c.empty());
39     assert(c.empty());
40     c.push_front(C::value_type(1));
41     assert(!c.empty());
42     c.clear();
43     assert(c.empty());
44     }
45 #endif
46 }
47