.


:




:

































 

 

 

 


- -




, (values), . , (entities) . - /, . - - ( , , , , , ), . - (, , , ) ( , ), , , - .

 

11. . . rvalue-. std::move.

 

2011. ++ - (Move constructors, Move assignment operators).

 

, , , , Stack.

++11 -, (move constructors). . , - , rvalue- , . rvalue-, .. , , lvalue:

 

 

int x;

int & simpleRefToRValue = x + 2; // - rvalue

int && rvalueRefToRValue = x + 2; // , rvalue- rvalue

, ( , ). -. , - , - -. , , rvalue-.

, , - . , :

● ;

● .

std::move:

Int main ()

{

Stack s1;

Stack s2(20);

s1 = std::move(s2);

}

std::move ,

//

BigClass (BigClass && _temporar)

: s(std::move(_copy.s)) // !

{

}

};

std::move, .

, , . ,

 

 





:


: 2016-07-29; !; : 430 |


:

:

, ,
==> ...

1436 - | 1403 -


© 2015-2024 lektsii.org - -

: 0.012 .