07_move_semantics

Download
text 106 lines 38.9 KB
  1������!H__PAGEZERO(__TEXT@@__text__TEXT8"8�__stubs__TEXTP'PP'�__gcc_except_tab__TEXT�(��(__const__TEXT�*�*__cstring__TEXT�*�*__unwind_info__TEXT�.p�.�__DATA_CONST@@@@__got__DATA_CONST@(@H__LINKEDIT�@��4���3����p�[(��P**6% �A /usr/lib/dyld���E80��x��G�J�2 �*(��0C�/usr/lib/libc++.1.dylib8L/usr/lib/libSystem.B.dylib&0�@)p�����O���{��C�3�s.@��!�*���B�R���!�*���b�R��A�R��Д+���"�R���!$+���b�R����R����"�R���!T+�����R����Rx���"�R���!�+����R����Rn���"�R���!0,�����R����Rd���"�R�{A��O¨����O��{���� �,@��!�,���Rz���R�s8H��R�,�r���C8��Ѣ��A�R)��s�8h�6�Z�\����j���ѡ�Ѫ�f���������a����_���R�9H��RȌ�r���s9���c���R���9h�6�@�A�����ѿ���L���R�_9H��RȬ�r���9�c���a�R���_�9h�6�@�.��c������c�9��c�������������������{O��ON����_����c������_�9�6�@������9��6�@�����������s�8�6�Z���������������������������������O���{��C��� �,@��!�6�B�R��h�@9	��K
  2A�l@�?qa����������!�6��R��a@����!�6�b�R��h@���h@�(	�h@�@� �,@����!�6�"�R��h@�	�Th@�@� �,@����!�6�"�R��h@�
  3�#Th@�	@� �,@����!�6�"�R��h@��Th@�
  4@� �,@����!�6�"�R��h@��#Th@�@� �,@����!�6�"�R��h@��T �,@��!�6�b�R �,@��!�6���R�� �,@��!+�"�R�{A��O¨��W���O��{�������� �,@��!8���R����@9	��K
  5A��@�?qa�������{��!T8���Rw�h�@9	��K
  6A�l@�?qa�������n��!x6�B�Rj��T`@�@�R��@�v���~���~����Q�`����@���j����{B��OA��Wè�_�����_��W��O��{��C�����(�m@�@��� �,@��!h8���RB����A��^@9*�@�_q���b���9��!T8���R5����A��^@9*��ˎ@�_q���b���+��!x6�B�R'��T`@�@���&@�h&��!�7�����R�� @����@����\@9���h��9h�6�@��u
  7��@�����@��r�x�9�~��@�)�)m@�)@�?�T���{E��OD��WC��_B�����_��A5�������O��{����3�s.@��!-���b�R����R	�)Y-���8(@����(Q@�����S8�!�-���b�R����Ѣ�R���!�-�B�R�����<��=��^��#���=���� �,@��!�-�B�R����^8	��}�?q���A���b������!�-�B�R�� �,@��!8.�B�R���A9	�/C�?q���A���b������!�-�B�R��������R�_9���Ȯ�����,�����#9�c���e� �,@��!�.���R���_@9	�/@�?q��A���b������!�-�B�R�� �,@��!�.�"�R���@�	]@9*1@�_qa����������!�-�B�R}��_�9h�6�@�i��@�3��@�����T
  8���T���8�bш��6�@�[�����@���W���9��7���8(�7�{G��OF����_��@�M����8(��6��]�I���������8��6�����_�9h�6�@�=��c�\���9��7���8��7����@�3����8h��6��]�/�����_���W��O��{������	�@�?
  9�"T �=(@�(	� �=?��?�6a�5���HU��k@�)�)�C����lU��4}���?�TJ�J�C�J}�K��	�i����������_�51��5���T�����}�������R���� �= �=(@�(	�?��?�6a�t"@��5������uZ�w
 10�t�����v��{C��OB��WA��_Ĩ�_������W���O��{������@�4�u@�����T
 11���T���8�bш��6�@������`@�t������{B��OA��Wè�_��O���{��C����,@��!$/���R��a@����!+�"�R�{A��O¨��O���{��C����,@��!|/���R��a@����!+�"�R�{A��O¨��W���O��{�����s.@��!�/�����R���!$/�����R��A�Ry���+���"�R����~/�������R����Rl���"�R��������R����Rc���"�R�{B��OA��Wè����W	��O
 12��{�����,@��!H0���Rw���R�9h.�R�
 13�r�3���R�,�r�3���9�C����A�R`���9h�6�@�V��,@��!�9��R`��C�a���]8	��|�?qA���b���W��!�6��RS��#{�	��B�-��!x6�B�RK����#��#{��`T4����9�����#�����K������a����8��7��=`�=�
 14@�h
 15���|���U��,@��!�9��R*��A9	�D�?qA���b���#��!�6��R��#C�	��B����!x6�B�R���<��=�\����;�����=���<�
 16@����~��
 17��,@��!�9��R���a��@9*�A�_qa����������!�6��R���#@�	��B����!x6�B�R���,@��!�0���R����9h�6�@����@�`�������9h�6�'@����@�`��������8h�6��\����[�`�������{K��OJ��WI����_ֽ�  �����9��6�@����������@�������
 18��������������C����s��O���{��C�����9h�6`@���`@�`�`������{A��O¨�_�������U����O��{��C��s.@��!`1���"�R���!2����R��H�R�_9�L�R�y��2�@����+9�c�����R8��_�9h�6�@�k��c�y����,@��!�2���Rs��c�?��{E��OD�����_����_�9�6�@�X���)����c�1���$����O��{�����,@��!p3�"�RW���R��9�M�RH-�r�#���9�����A�R�����9h�6�@�9����V��]����<�=������<��^����>����L����J�������#��������,@��!�3���R/��@����@�����T
 19��@T���8h�6��^���^�����������@���
 20����9h�6�@���@���@�����8h�6��]����]���@����{G��OF����_��������9��6�@����������#�5������P����N������O���{��C����,@��!<:���R��h~@9	��K�@�l
 21@�?qa����������!p:�b�R��h@���@��,@����,@��!�6���R���,@��!+�"�R�{A��O¨��W���O��{������@���u@�����T
 22��@T���8h�6��^����^�����������`@�t������{B��OA��Wè�_��O���{��C���|�9h�6`@���`@��@������{A��O¨�_��O���{��C��s.@��!,4���"�R���!�4���b�R������������������������!����!�5�����R|��R�{A��O¨�_��{������5���O���{��C����Rf�������!�@��B@���i�����c���"��{����(��I@�A���{���_��{�����RK� ��!D@��B@�Q��{����E�2��W���O��{���������(�~�)�~�?���/�`�tB��^�9��7��=�
 23@��
 24���=�
 25@���U��,@��!6��R*�h�@9	j.A�?qA���b���#��!X6���R�a@����!x6�B�R�h@���i@��bT
 26��.�A�bT
 27��
 28�|�`��=,���OO�OO�
 29���N��N��N�?������N�A�!��T
 30�`T~�T�
 31��
 32N
 33�~�a��=�N+	��
 34ˁO`�<��N�����T
 35��h��9h�6�@�������*y*�J�
 36���T���{B��OA��Wè�_��W���O��{������_X�hT\9��}��BT����h
 37@�]�)�R4�������A�Ӣ�����b��{B��OA��Wè�G����g���_��W��O��{�������(@��	�~��~�� �ڢ�`���@9�@�?q5�������}�_��TxB�__�TH@�]�)�R7���������A�z��`
 38������z�9��B�	@�?q!������������k�R�
 39�r	�)�R		y�,@��!47���R�h�@9	j.A�?qA���b���x��!x6�B�Rt�h@����@��~�`@�����{D��OC��WB��_A��gŨ�_�������h��9h�6@�Q���"��W���O��{��������($@�$��!�7��B���R$�uB��=@��
 40���=����,@��!�7���RE�h�@9	j.A�?qA���b���>��!x6�B�R:��~����{B��OA��Wè�_������O���{��C����,@��!�8���R)����A��^@9*�@�_q���b��� ��!x6�B�R�`@�@��h��9h�6�@�����{A��O¨�_������{������8������_���W��O��{����������|������~�����~�������`��h
 41������h�ub��^�9��7��=�
 42@��
 43���=�
 44@���
 45����,@��!9���R��h�@9	j�A�?qA���b������!x6�B�R��4�h@���bT	��(
 46��B�bT	����|�@��=���OO�OO�	���N��N��N`?�f����N�A�!��T?�T�~��T�	�`
 47N��~�A��=�N
 48	�k	ˁO@�<��Nk����T?�T	y)�)��	���T���{C��OB��WA��_Ĩ�_֐���  �����h��9h�6�@���`@�`�`�����S��W���O��{������������R}��������^�9��7��=�
 49@��
 50���=�
 51@��������,@��!�9�"�Rt�h~@9	j�@�?qA���b���m��!x6�B�Ri����{B��OA��Wè�_�����h~�9h�6�@�M�`@��@�I�����_���W��O��{����$@�)�5�E���*�{�J	�����
 52@���{�H�
 53�D�_	�I������61������{Ө���{�2������@����<�~�	���<�@�	
 54��~���ub@���	��T����*@�?�
 55� ��<*
 56@�
 57
 58���<?}�?�)����?���T�����@T�~�9h�6�@���@�����������u@�wR�v
 59�u��������{C��OB��WA��_Ĩ�_�������������g��_��W��O��{�����������#������#@9qaTh@��^�d��@��@���@��1AT�c��������!0@��c���@�@��R?����c�����7���R
 60���qb�������*��h@��^�`� @���R	*���#������{F��OE��WD��_C��gB�����_����c������#���������h@��^�`��������������j�[�������g��_��W��O��{������
 61����������@�i�	����Y�?�Th@�1@�����?��T���T��}���"T�^�T�9�#��
 62@�]�)�R:����q���HA��#�����������?k78��9�@�q�#�!���h@�1@�����?���9��7��T�@�����O�����T����+Th@�1@�������?��aT�������{F��OE��WD��_C��gB�����_���������9h�6�@�0�����f@���@���@���
 63@���@���@���@���"@���&@���*@���6@���:@���>@���B@����@����@����@����@���N@���R@���V@���Z@���^@���j@���r@���v@���z@���~@����<@@�`�h�t���������������0����}}��PP0�����������7PP�pl����D���d�������p��dd�� ��H�� @@�`����(�����<$,��``\�������D��T��
 64 t���
 65L��� 8�@D���D����<��PP�XD��H��A6(�`�p ������`�������������
 66=== Value Categories ===
 67lvalue x = 
 68lvalue y = rvalue (x + y) stored in z = rvalue reference ref2 = const lvalue reference ref3 = 
 69=== Rule of Five ===
 70
 71=== std::move ===
 72Hello, World!str1 before move: ''
 73str1 after move: 'str2 after move: 'str3 after push_back(move): 'vec[0]: '  Processing lvalue:   Processing rvalue: 
 74=== Perfect Forwarding ===
 75
 76=== Rule of Zero ===
 77simple1  No manual memory management needed!
 78
 79=== Return Value Optimization (RVO) ===
 80Creating buffer via function...
 81rvo_bufferNote: No move/copy constructor called (RVO)!
 82
 83=== Move-Only Types ===
 84  Moved into vector
 85Move Semantics and Value Categories Demo
 86==========================================
 87
 88All demos completed!
 89basic_string  [Constructor: , size=]
 90  Buffer '' [size=]:  ...(empty)_copy  [Copy constructor: _moved  [Move constructor:   [Copy assignment:  ->   [Move assignment:   [Destructor: vector  [SimpleBuffer constructor:   SimpleBuffer '  [MoveOnly constructor:   MoveOnly '': <@TTTT�@8�dP'�8�(�
 91�(h�(@ )�\)�t)|�)(�)P�)��)|�) �)"*D$,*�%p* ���0
 92P�P
 93P���H�t0D����D����x ���������	�
 94���
 95������������������� �!�"�#�$� P�%@@P���4v�p��,X�$`���4Nz�����$�P�`�p�~__ZNKSt3__16locale9use_facetERNS0_2idE__ZNKSt3__18ios_base6getlocEv__ZNSt11logic_errorC2EPKc__ZNSt12length_errorD1Ev__ZNSt20bad_array_new_lengthC1Ev__ZNSt20bad_array_new_lengthD1Ev__ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6appendEPKcm__ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEE6sentryC1ERS3___ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEE6sentryD1Ev__ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEElsEi__ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEElsEm__ZNSt3__14coutE__ZNSt3__15ctypeIcE2idE__ZNSt3__16localeD1Ev__ZNSt3__18ios_base33__set_badbit_and_consider_rethrowEv__ZNSt3__18ios_base5clearEj__ZSt9terminatev__ZTISt20bad_array_new_length__ZTVSt12length_error___cxa_allocate_exception___cxa_begin_catch___cxa_end_catch___cxa_free_exception___cxa_throw___gxx_personality_v0__Unwind_Resume___stack_chk_fail___stack_chk_guard_bzero_memcpy_memmove_memset__ZTISt12length_error__ZdaPv__ZdlPv__Znam__Znwm_��+�create_buffermRKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE	demo_std_movev�-�!�"lvalueRizrvalueOidemo_move_onlyvuprocess_���$fivev�zerov�34�7demo_rule_of_��
 96�#1demo_value_categoriesv�3demo_perfect_forwardingv��+1�2�8demo_rvov�Z�mh_execute_header��3_�main��
 97�������pHH��@���|@|P$(�x��������D�
 98*��
 99<�T�����*��A�0����h��|#��H��w���(���B�PU��g�|w� �� 	� �	� �	�"8
100��"�
101�D$�
102��%|�(��(��(� )�\)�t)��)��)�)$�)7�)J�)]*p,*�p*�Vhj���@�8�@�8���#7�=Mt����T��9Jbx����(08?F`s���������6789;=>?@ADEFGKLMNOPQRSUWXYZ789:;<=>?@ABCDEFGIJOPQRST6UVWXYZHKLMN __Z13create_buffermRKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE__Z13demo_std_movev__Z14demo_move_onlyv__Z14process_lvalueRi__Z14process_rvalueOi__Z17demo_rule_of_fivev__Z17demo_rule_of_zerov__Z21demo_value_categoriesv__Z23demo_perfect_forwardingv__Z8demo_rvov__mh_execute_header_main__Unwind_Resume__ZNKSt3__16locale9use_facetERNS0_2idE__ZNKSt3__18ios_base6getlocEv__ZNSt11logic_errorC2EPKc__ZNSt12length_errorD1Ev__ZNSt20bad_array_new_lengthC1Ev__ZNSt20bad_array_new_lengthD1Ev__ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6appendEPKcm__ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEE6sentryC1ERS3___ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEE6sentryD1Ev__ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEElsEi__ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEElsEm__ZNSt3__14coutE__ZNSt3__15ctypeIcE2idE__ZNSt3__16localeD1Ev__ZNSt3__18ios_base33__set_badbit_and_consider_rethrowEv__ZNSt3__18ios_base5clearEj__ZSt9terminatev__ZTISt12length_error__ZTISt20bad_array_new_length__ZTVSt12length_error__ZdaPv__ZdlPv__Znam__Znwm___cxa_allocate_exception___cxa_begin_catch___cxa_end_catch___cxa_free_exception___cxa_throw___gxx_personality_v0___stack_chk_fail___stack_chk_guard_bzero_memcpy_memmove_memset__ZNK6Buffer5printEv__ZN6BufferaSERKS___ZN6BufferaSEOS___ZNSt3__16vectorINS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEENS4_IS6_EEE9push_backB8ne200100EOS6___ZNSt3__16vectorINS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEENS4_IS6_EEED1B8ne200100Ev__ZN12SimpleBufferD1Ev__ZNK8MoveOnly5printEv__ZNSt3__16vectorI8MoveOnlyNS_9allocatorIS1_EEED1B8ne200100Ev__ZN8MoveOnlyD1Ev__ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE20__throw_length_errorB8ne200100Ev__ZNSt3__120__throw_length_errorB8ne200100EPKc__ZNSt12length_errorC1B8ne200100EPKc__ZSt28__throw_bad_array_new_lengthB8ne200100v___clang_call_terminate__ZN6BufferC2EmRKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE__ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE25__init_copy_ctor_externalEPKcm__ZN6BufferC2ERKS___ZN6BufferC2EOS___ZN6BufferD2Ev__ZNSt3__16vectorIiNS_9allocatorIiEEE20__throw_length_errorB8ne200100Ev__ZNSt3__16vectorI8MoveOnlyNS_9allocatorIS1_EEE20__throw_length_errorB8ne200100Ev__ZNSt3__16vectorINS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEENS4_IS6_EEE20__throw_length_errorB8ne200100Ev__ZN12SimpleBufferC2EmRKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE__ZN8MoveOnlyC2EiRKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE__ZNSt3__16vectorI8MoveOnlyNS_9allocatorIS1_EEE24__emplace_back_slow_pathIJS1_EEEPS1_DpOT___ZNSt3__124__put_character_sequenceB8ne200100IcNS_11char_traitsIcEEEERNS_13basic_ostreamIT_T0_EES7_PKS4_m__ZNSt3__116__pad_and_outputB8ne200100IcNS_11char_traitsIcEEEENS_19ostreambuf_iteratorIT_T0_EES6_PKS4_S8_S8_RNS_8ios_baseES4_GCC_except_table1GCC_except_table4GCC_except_table5GCC_except_table11GCC_except_table14GCC_except_table15GCC_except_table21GCC_except_table25GCC_except_table27GCC_except_table28GCC_except_table29GCC_except_table31GCC_except_table33GCC_except_table36GCC_except_table37�������jX
103�� "07_move_semantics�ة��sb���p���ij�H�#Z�ՁR��K�cܽږ%z�{�Ж�iC�<gEn8%Y9uIJ�4Y߇�\��DR�.�N��Jz���)�<��I�yu�
104a��e��S�e�D�X
105�RJU�g��v����i�)%���k_�;�I�}�\;���Xo��f����kOX�|�|z�ڽ�H�,����Xo��f����kOX�|�|z�ڽ�H�,����Xo��f����kOX�|�|z�ڽ�H�,�]6�qY�t:X}��뿳�*~������D�*χo��C
106�R�c$��b+�WV4�BrR��℘�>7}