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 // <list> 11 12 // void resize(size_type sz, const value_type& x); 13 14 #include <list> 15 #include <cassert> 16 #include "../../../DefaultOnly.h" 17 #include "../../../min_allocator.h" 18 19 int main() 20 { 21 { 22 std::list<double> l(5, 2); 23 l.resize(2, 3.5); 24 assert(l.size() == 2); 25 assert(std::distance(l.begin(), l.end()) == 2); 26 assert(l == std::list<double>(2, 2)); 27 } 28 { 29 std::list<double> l(5, 2); 30 l.resize(10, 3.5); 31 assert(l.size() == 10); 32 assert(std::distance(l.begin(), l.end()) == 10); 33 assert(l.front() == 2); 34 assert(l.back() == 3.5); 35 } 36 #if __cplusplus >= 201103L 37 { 38 std::list<double, min_allocator<double>> l(5, 2); 39 l.resize(2, 3.5); 40 assert(l.size() == 2); 41 assert(std::distance(l.begin(), l.end()) == 2); 42 assert((l == std::list<double, min_allocator<double>>(2, 2))); 43 } 44 { 45 std::list<double, min_allocator<double>> l(5, 2); 46 l.resize(10, 3.5); 47 assert(l.size() == 10); 48 assert(std::distance(l.begin(), l.end()) == 10); 49 assert(l.front() == 2); 50 assert(l.back() == 3.5); 51 } 52 #endif 53 } 54