http://definedbehavior.blogspot.tw/2011/08/value-semantics-copy-elision.html

 

注意其中一段話 :

 

The compiler will elide copies when returning from a function

and when calling a function that takes the argument by value

 

還有就是 :

 

type f() {
   return type();
}
type g( type arg ) {
   return arg;
}
int main() {
   type x = g( f() );
}

compiler 沒有做 copy elision

 

 

arrow
arrow
    全站熱搜

    hedgezzz 發表在 痞客邦 留言(0) 人氣()