Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

return value optimization example

#include<iostream>
struct Box {
  Box() = default;
  Box(const Box&) { 
      std::cout << "Copy Constructor being called 
"; 
    }
};
 
Box func() {
  return Box();
}
 
int main() {
  std::cout << "Main function entered
";
  Box obj = func();
}
 
PREVIOUS NEXT
Tagged: #return #optimization
ADD COMMENT
Topic
Name
6+3 =