Search Results

Search found 1 results on 1 pages for 'aiao'.

Page 1/1 | 1 

  • Difference between c++11 vs c++03

    - by aiao
    I have spend a few hours about rvalue s and lvalue. Here is what I understand int main() { //..... Foo foo = Bar1(); Foo foo = Bar2(); //...... } Foo Bar1() { //Do something return foo; } Foo& Bar2() { //Do something return foo; } Under c++03, Bar1() would copy the return object (just before return), and then return the address of the copied object; executing a wasteful copy of an object which is about to be destroyed. Bar2() would return the object created within the function. Under c++11, Bar1() and Bar2() would essentially be equivalent (and also equivalent to Bar2() of c++03). Is that right? If not, please elaborate.

    Read the article

1