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 // UNSUPPORTED: c++98, c++03 11 12 // <forward_list> 13 14 // void push_front(value_type&& v); 15 16 #include <forward_list> 17 #include <cassert> 18 19 #include "MoveOnly.h" 20 #include "min_allocator.h" 21 22 int main() 23 { 24 { 25 typedef MoveOnly T; 26 typedef std::forward_list<T> C; 27 C c; 28 c.push_front(1); 29 assert(c.front() == 1); 30 assert(distance(c.begin(), c.end()) == 1); 31 c.push_front(3); 32 assert(c.front() == 3); 33 assert(*next(c.begin()) == 1); 34 assert(distance(c.begin(), c.end()) == 2); 35 } 36 { 37 typedef MoveOnly T; 38 typedef std::forward_list<T, min_allocator<T>> C; 39 C c; 40 c.push_front(1); 41 assert(c.front() == 1); 42 assert(distance(c.begin(), c.end()) == 1); 43 c.push_front(3); 44 assert(c.front() == 3); 45 assert(*next(c.begin()) == 1); 46 assert(distance(c.begin(), c.end()) == 2); 47 } 48 } 49