int main() { int a = 0; if (!a) { std::cout << "IF"; } std::deque<int> nums1 {3, 1, 4, 6, 5, 9}; std::deque<int> nums2; std::deque<int> nums3; std::cout << "Initially:\n"; display_sizes(nums1, nums2, nums3); // copy assignment copies data from nums1 to nums2 nums2 = nums1; std::cout << "After assigment:\n"; display_sizes(nums1, nums2, nums3); // move assignment moves data from nums1 to nums3, // modifying both nums1 and nums3 nums3 = std::move(nums1); std::cout << "After move assigment:\n"; display_sizes(nums1, nums2, nums3); }
int main() { Hx::circular_buffer<int> nums1 = {3, 1, 4, 6, 5, 9}; Hx::circular_buffer<int> nums2; Hx::circular_buffer<int> nums3; std::cout << "Initially:\n"; display_sizes(nums1, nums2, nums3); // copy assignment copies data from nums1 to nums2 nums2 = nums1; std::cout << "After assigment:\n"; display_sizes(nums1, nums2, nums3); // move assignment moves data from nums1 to nums3, // modifying both nums1 and nums3 nums3 = std::move(nums1); std::cout << "After move assigment:\n"; display_sizes(nums1, nums2, nums3); }