473,387 Members | 1,549 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

question about boost::scoped_ptr

I have code:

boost::scoped_ptr< CSpectrograph > m_pSpectrograph;

....
m_pSpectrograph.reset( new CSpectrograph(init_data) );
....

But I found the CSpectrograph destructor never been called. What is
wrong?

Apr 12 '06 #1
2 1839
kathy wrote:
I have code:

boost::scoped_ptr< CSpectrograph > m_pSpectrograph;

...
m_pSpectrograph.reset( new CSpectrograph(init_data) );
...

But I found the CSpectrograph destructor never been called. What is
wrong?


Why not use boost::shared_ptr? The first thing I did when installing boost
was write a test case demonstrating that boost::shared_ptr calls a
destructor.

BTW you have better odds of good answers on the Boost-User mailing list.
Fewer of us Boost here than there ;-)

--
Phlip
http://www.greencheese.org/ZeekLand <-- NOT a blog!!!
Apr 12 '06 #2
kathy wrote:
I have code:

boost::scoped_ptr< CSpectrograph > m_pSpectrograph;

...
m_pSpectrograph.reset( new CSpectrograph(init_data) );
...

But I found the CSpectrograph destructor never been called. What is
wrong?


Are you saying m_pSpectrograph has gone out of scope, and it's managed
CSpectrograph instance has not been destructed?

Jeff Flinn
Apr 12 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: ctick | last post by:
Are there any advantages of using boost::shared_ptr other than auto_ptr from standard library?
2
by: PengYu.UT | last post by:
Hi, I saw the following code: Composition *quick = new Composition(new SimpleCompositor); SimpleCompositor and Composition are both classes. My question is how to delete the newed...
2
by: krema2ren | last post by:
Hi I've the following header problem that I need two classes to know each other through a boost::shared_ptr. Does any of you smart guys have a solution? A.h ---------------------- #include...
14
by: kathy | last post by:
I have a vector which I save the pointer. function() { std::vector <CMyData*> vpMyData; vpMyData.push_back(new CMyData(0)); vpMyData.push_back(new CMyData(1)); vpMyData.push_back(new...
3
by: yinglcs | last post by:
I am reading the Boost scoped_ptr library, and I wonder what is the advantage of using that. Here is an example from Boost.org web site: #include <boost/scoped_ptr.hpp> #include <iostream> ...
5
by: Bit Byter | last post by:
I have a 'root' object that serves as a container/parent for several other objects like so: class myRoot { public: myRoot(); virtual ~myRoot(); void* operator new(size_t); operator...
16
by: Yong Hu | last post by:
Does the smart pointer never lead to memory leak? Thanks,
8
by: toton | last post by:
Hi, I am using some smart_ptr (from Axter) in a STL vector. However I need a custom deleter other than destructor (In my case a free member function, which exists due to Historic reason only, do...
4
by: none | last post by:
Hello, At work we have someone who believes that using new&delete is a hideous sin. He believes it should never be used. Instead scoped_ptr is the enlightened way. Does anyone have a view?
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.