nikhil
nikhil

Reputation: 9363

auto pointer in 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?

Upvotes: 4

Views: 1033

Answers (5)

cpx
cpx

Reputation: 17567

Here's a reference to Scott Meyers's auto_ptr

Upvotes: 0

Lightness Races in Orbit
Lightness Races in Orbit

Reputation: 385204

It's a template, so it's all in the header.

Upvotes: 0

Raedwald
Raedwald

Reputation: 48682

It is a template class, so the details are exposed in the header file: take a look.

Upvotes: 0

icecrime
icecrime

Reputation: 76775

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.

Upvotes: 4

David Thornley
David Thornley

Reputation: 57046

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.

Upvotes: 7

Related Questions