Example:
Foo make_foo(int a1, int a2){
Foo f(a1,a2);
return f;
}
Having seen such functions several times, is it just a matter of coding style / preference, or is there something more than it seems at first glance? In particular, this answer made me think with implementation make_unique, and the requirement - a safe exception - is this related to the splitting of creation and return? Or am I reading too much about this? Why not just write
Foo make_foo(int a1, int a2){
return Foo(a1,a2);
}
source
share