The problem I see here is that one of the functions returns a pointer and it doesn't use the usual pointer syntax.
I see no *, no & and no -> in the code. So I would assume everything to behave as if it was owned or even copied. Had it returned actual pointers, or pointer-like objects like iterators, it would have been more obvious.
Comments
The problem I see here is that one of the functions returns a pointer and it doesn't use the usual pointer syntax.
I see no *, no & and no -> in the code. So I would assume everything to behave as if it was owned or even copied. Had it returned actual pointers, or pointer-like objects like iterators, it would have been more obvious.
This is C++ we’re talking about.
Is x a pointer or reference? There’s no way to tell. Maybe if you then do You have some idea that x is pointer-ish, but unique_ptr works like this and isn’t very pointer-ish.