I have a function like this:
unique_ptr<int> foo() {
return unique_ptr<int>(new int[4])
}
When calling this foo(), what I do is:
unique_ptr<int> t = foo()
I am wondering is there any problem in this piece of code? Should I use something like std::move instead of assigning directly? Can I return the unique ptr by reference, like:
unique_ptr<int>& foo() {
return unique_ptr<int>(new int[4])
}