Reputation: 957
Is there something like unique_ptr<> in Visual Studio 2008?
Event Visual Studio only header is also OK.
I want this feature but do not want to use 3-rd party lib. Since I am writing sample/learning code.
If not, I will have to use raw pointer directly, for simplification. Although I feel uncomfortable....
Upvotes: 3
Views: 1840
Reputation: 24576
VS2008 does not support rvalue references and thus no move operations. unique_ptr
behavior relies on those, so there can be no exact replacement in C++03. auto_ptr
uses the copy-Ctor to do what should be done by the move-Ctor. You could use those, but I'd recommend against it, because the compiler can't help you find unwanted copies like he does with unique_ptr
.
Also see here: unique_ptr boost equivalent?
Upvotes: 3