Is there any potential problems with using unique_ptr where a raw pointer is expected?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
void bar (int* i)
{
*i *= *i;
}
int main()
{
std::unique_ptr<int> up{new int};
*up = 6;
bar(&(*up));
std::cout << *up << std::endl;
return 0;
}
|
Last edited on
Thank you for a complete answer.