Taking this as an example:
#include <memory>
#include <iostream>
int add(int a, int b) {
    return a+b;
}
std::unique_ptr<int> addp(int a, int b) {
    std::unique_ptr<int> ip(new int(a + b));
    return ip;
}
int main(int argc, char const* argv[])
{
    std::cout << add(3, 5) << std::endl;
    std::cout << *(addp(3, 5)) << std::endl;
    return 0;
}
does the function addp give any improvement in performence, or in other words, does
it avoid the copying of data at all? I am suspecting that the result a+b is
got in the stack and then copied to the heap any way.
 
     
     
     
     
    