unique_ptr::get returns raw pointer by value, you cannot bind Rvalue (temporary object) - a.get() to non-const Lvalue reference. Change signature of abc to abc(int*) or abc(int* const &).
adding to @darune's answer you have to use the following: std::unique_ptr<int> a = std::make_unique<int>(); abc(a); you can't initialize smart pointers like std::unique_ptr<int> a(new int);
@shesharp That's incorrect. Especially considering that std::make_unique wasn't introduced until the C++14 standard, while std::unique_ptr was introduced in the C++11 standard.
@Someprogrammerdude thanks for pointing that out! I thought error was due to std::unique_ptr<int> a(new int); Im used to using it with make_unique i thought it was wrong.
unique_ptr::getreturns raw pointer by value, you cannot bind Rvalue (temporary object) -a.get()to non-const Lvalue reference. Change signature ofabctoabc(int*)orabc(int* const &).std::make_uniquewasn't introduced until the C++14 standard, whilestd::unique_ptrwas introduced in the C++11 standard.