question about boost::scoped_ptr

K

kathy

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?
 
P

Phlip

kathy said:
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 ;-)
 
J

Jeff Flinn

kathy said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top