看板 C_and_CPP 關於我們 聯絡資訊
: 再請問一下,下面的是錯在哪呢? : (1) const string& ref2 = string("hala"); : (2) const vector<int>& ref = vector<int>(); 剛剛看到的 (12.2.5) The temporary to which the reference is bound or the temporary that is the complete object of a subobject to which the reference is bound persists for the lifetime of the reference except as specified below. ...略 In all these cases, the temporaries created during the evaluation of the expression initializing the reference, except the temporary to which the reference is bound, are destroyed at the end of the full -expression in which they are created and in the reverse order of the completion of their construction. -- 貓 http://www.onlypet.com.tw/dendrobium -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 61.31.128.208
QQ29:請教英文了 他這邊一直提到的bound 是啥意思?? 09/16 02:49
QQ29:而且其實有點不了解他在講什麼...有強者大大解事一下嘛? 09/16 02:51
kkc:剛剛查了一下 這篇講得還蠻清楚的 http://0rz.tw/vFZOS 09/16 04:02
kkc:差點忘記還有RVO這個東西 也是這樣弄的~ 09/16 04:02