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 // <vector> 10 11 // vector& operator=(const vector& c); 12 13 #include <vector> 14 #include <cassert> 15 #include "test_allocator.h" 16 #include "min_allocator.h" 17 18 int main(int, char**) 19 { 20 { 21 std::vector<bool, test_allocator<bool> > l(3, true, test_allocator<bool>(5)); 22 std::vector<bool, test_allocator<bool> > l2(l, test_allocator<bool>(3)); 23 l2 = l; 24 assert(l2 == l); 25 assert(l2.get_allocator() == test_allocator<bool>(3)); 26 } 27 { 28 std::vector<bool, other_allocator<bool> > l(3, true, other_allocator<bool>(5)); 29 std::vector<bool, other_allocator<bool> > l2(l, other_allocator<bool>(3)); 30 l2 = l; 31 assert(l2 == l); 32 assert(l2.get_allocator() == other_allocator<bool>(5)); 33 } 34 #if TEST_STD_VER >= 11 35 { 36 std::vector<bool, min_allocator<bool> > l(3, true, min_allocator<bool>()); 37 std::vector<bool, min_allocator<bool> > l2(l, min_allocator<bool>()); 38 l2 = l; 39 assert(l2 == l); 40 assert(l2.get_allocator() == min_allocator<bool>()); 41 } 42 #endif 43 44 return 0; 45 } 46