Implementation of smart pointer:

template <class T> class *auto_ptr*
{
    T* ptr;public:
    explicit *auto_ptr*(T* p = 0) : ptr(p) {}
    *~auto_ptr*()                 {delete ptr;}
    T& *operator**()              {return *ptr;}
    T* *operator->*()             {return ptr;}
    // ...};

Its all there in this link:

http://ootips.org/yonat/4dev/smart-pointers.html


On Mon, Jul 18, 2011 at 7:45 PM, DK <[email protected]> wrote:

> I would suggest that you open the include files of your C++ compiler
> distribution and see how the auto_ptr class is implemented.
> It's not difficult.
>
> Here's how it's implemented in GCC.
> (see attachment).
>
> Just ignore all the GCC rubbish and the uglified names.
>
> --
> DK
>
> http://twitter.com/divyekapoor
> http://www.divye.in
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/algogeeks/-/BaL5bORA0EwJ.
>
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to