Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

auto pointer in c++

Tags:

c++

I am curious to know how an auto_ptr is implemented in c++. And i tried to find out where the source of it is located in ubuntu 10.04. I could only find the .h file but couldn't find its implementation. where can i find it?

like image 897
nikhil Avatar asked Dec 22 '22 18:12

nikhil


2 Answers

The .h file is almost certainly its implementation. auto_ptr is a template. Since template implementations need to be included in full, they're normally in the .h files.

like image 200
David Thornley Avatar answered Dec 24 '22 07:12

David Thornley


The auto_ptr is a template, and the whole code is most likely in the header file.

You can check on libstdc++ 4.4 implementation here.

like image 28
icecrime Avatar answered Dec 24 '22 08:12

icecrime