c++ - Is better to think of the '=' operator as morphing? -


this trivial question.

i have minimal background in c++ , if remember correctly have been told think of operator way:

int x = 1,y = 2; x = y; //put whatever in y x;  

but after reading lvalues , rvalues, think more suitable think of way: morph (change) whatever in x whatever in y. reason think because object referenced x semantically still same object right?

not sure if makes difference data type int whether view replacement of it's value "put whatever in x y" or "morphing". anyway, online c++ standard draft concerning assignment operator describes process follows:

5.17 (2) in simple assignment (=), value of expression replaces of object referred left operand.

not sure if answers question, taking formulation 1 "the value of object replaced, object remains same".


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -