std::unique_ptr is a move only type(cannot be copied), if you want to pass it in to the function as a parameter, you can

1 : pass by reference

int TestPrint(std::unique_ptr&lt;T_TEST&gt; const &amp;p_pData)
{
    printf("T1 in TestPrint Func = [%02x]\n", p_pData-&gt;cT1);
    printf("T2 in TestPrint Func = [%02x]\n", p_pData-&gt;cT2);
    return 0;
}


2 : move it

TestPrint(std::move(pTest));


3 : do not use unique_ptr as parameter, use pointer

int TestPrint(T_TEST *p_pData)
{
    printf("T1 in TestPrint Func = [%02x]\n", p_pData-&gt;cT1);
    printf("T2 in TestPrint Func = [%02x]\n", p_pData-&gt;cT2);
    return 0;
}

TestPrint(pTest.get());


Pointer is bad at resource management, but good at access resource, if you do not need to pass the ownership to the function, you can use pointer to replace unique_ptr, this is more flexible IMHO, because the raw pointer can work with shared_ptr, unique_ptr, weal_ptr and other smart pointer, but unique_ptr must work with unique_ptr only.

In most cases, I only use smart pointer as a function parameter when I want to share(std::shared_ptr) or transfer ownership(std::unique_ptr).

Can std::unique_ptr be used as an argument?
Recently, I saw an online presentation by a researcher and professor regarding a series of recently published papers. At the end, she mentioned she was working on a follow-up paper, regarding such and such... I have checked for it, and it has still not been published.

Perhaps it was a dead-end, and abandoned. Would it be appropriate to ask the professor about the progess made, and whether it has been abandoned, or when it will be published?
