Convert from auto_ptr to a regular pointer

I have third-party libraries that generate and return auto_ptr. However, I really want to use some STL containers.

So, I guess one way would be to convert

auto_ptr <int> ptr = some_library_call ();

to a regular C ++ pointer. Will there be a next job?

int* myptr = ptr;

If not, what is the best way to use STL with auto_ptr (yes, I know that this will not work directly ... I know that stl and auto_ptr do not mix together)?

+3
source share
2 answers

ptr.get(), , auto_ptr , ptr.release(), , auto_ptr ( .)

+8
+3

All Articles