In order to add new functionality to an old C++ application I need to include code that uses std::unique_ptr
.
You cannot do that directly. Your only option is to backport that code. I'll mention your options to do that below.
Is there a version of STL that compiles on VS2008 and does include std::unique_ptr
?
Not that I'm aware of one (see here as well please). Also I suppose you mean the c++-standard library and not the STL (which is a pre-standard c++ implementation that was provided back in the 90ies of the last century).
Alternatively, is there a way to replicate its functionality?
There are two (reasonable) options for creating a backport of code using std::unique_ptr
:
A similar functionality is provided with the old standards std::auto_ptr
, but it has some deficiencies compared to std::uniqe_ptr
.
You may try boost::unique_ptr
which was a pre c++11 standard implementation.
This implementation fixes a number of the flaws provided with the std::auto_ptr
, but lacks real moving still (with older boost versions that are VS2008 compatible).