Dlaczego unique_ptr <T> (T *) jest jawny?
Następujące funkcje nie są kompilowane:
std::unique_ptr<int> foo()
{
int* answer = new int(42);
return answer;
}
std::unique_ptr<int> bar()
{
return new int(42);
}
Uważam to za nieco niewygodne. Jakie było uzasadnieniestd::unique_ptr<T>(T*)
wyraźny?