C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Where can I find destructor of the template shared_ptr?

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language, library and standards
View previous topic :: View next topic  
Author Message
hzhuo1@gmail.com
Guest





PostPosted: Wed Jul 12, 2006 4:20 pm    Post subject: Where can I find destructor of the template shared_ptr? Reply with quote



In the standard C++ TR1 draft, I find the following regulation:

2.2.3.2 shared_ptr destructor
~shared_ptr();
1 Effects:
- If *this is empty, there are no side effects.
- If *this shares ownership with another shared_ptr instance
(use_count() >
1), decrements that instance's
use count.
- Otherwise, if *this owns a pointer p and a deleter d, d(p) is
called.
- Otherwise, *this owns a pointer p, and delete p is called.
2 Throws: nothing.

But when I refer to shared_ptr.hpp implemented by Boost,I can't find
any destructors of shared_ptr.Who can tell me how it is implemented?I
will be appreciative.

The library Boost can be downloaded as a .zip file at the following
webpage:
http://sourceforge.net/project/showfiles.php?group_id=7586
And the webpage of Boost is http://boost.sourceforge.net/.

---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]
Back to top
Richard Smith
Guest





PostPosted: Wed Jul 12, 2006 6:55 pm    Post subject: Re: Where can I find destructor of the template shared_ptr? Reply with quote



hzhuo1 (AT) gmail (DOT) com wrote:
Quote:
In the standard C++ TR1 draft, I find the following regulation:

[...]

But when I refer to shared_ptr.hpp implemented by Boost,I can't find
any destructors of shared_ptr.

The compiler generated implentation does the right thing -- it calls
the destructor on each member and one of these (specifically, the
detail::shared_count member) does the action described in your quote
from TR1.

Quote:
Who can tell me how it is implemented?I

Have a look in boost/detail/shared_count.hpp. But if you just want to
know what it does, rather than how it does it, it does what the boost
and/or TR1 documentation says it does.

--
Richard Smith

---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]
Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language, library and standards All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.