Veiasai / study-reference

MIT License
0 stars 0 forks source link

copy elision #9

Open Veiasai opened 5 years ago

Veiasai commented 5 years ago

https://zh.cppreference.com/w/cpp/language/copy_elision

https://stackoverflow.com/questions/18486598/c-unexpected-behaviour-where-are-my-temporaries

Veiasai commented 5 years ago

T t = T(xx); 等价于T t(xxx); T t = func(); T func(); func会直接在t的空间上执行,也不会触发赋值。 总之,声明的时候用=,不会触发赋值。