By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,238 Members | 1,804 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,238 IT Pros & Developers. It's quick & easy.

boost::shared_ptr inside stl::list

P: n/a
This one has been driving me nuts all day. In a function I have the
following:

std::list< boost::shared_ptr<MyObject> > * objectList;
When debugging my code, the debugger (gdb) dies upon entering the
function with this in it. It says "The Debugger has exited due to signal
11 (SIGSEGV).The Debugger has exited due to signal 11 (SIGSEGV)." My dev
tools felt the need to say it twice for some reason. I pulled this out
and put it in a new project all by itself with the same result.

If I make it not be a pointer, like this:

std::list< boost::shared_ptr<MyObject> > objectList;

then there's no problem.

Oddly, both versions of the code work fine when run normally (not being
debugged.)

I don't see what's wrong with the first version. Is it OK to put boost
shared ptrs in a std::list? Is there something else I'm missing?

Or is my dev environment just having problems?
-jim
Jul 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
"James Mastro" <do**@email.me> wrote in message
news:do************************@syrcnyrdrs-02-ge0.nyroc.rr.com...
This one has been driving me nuts all day. In a function I have the
following:

std::list< boost::shared_ptr<MyObject> > * objectList;
When debugging my code, the debugger (gdb) dies upon entering the
function with this in it. It says "The Debugger has exited due to signal
11 (SIGSEGV).The Debugger has exited due to signal 11 (SIGSEGV)." My dev
tools felt the need to say it twice for some reason. I pulled this out
and put it in a new project all by itself with the same result.

If I make it not be a pointer, like this:

std::list< boost::shared_ptr<MyObject> > objectList;

then there's no problem.

Oddly, both versions of the code work fine when run normally (not being
debugged.)

I don't see what's wrong with the first version. Is it OK to put boost
shared ptrs in a std::list? Is there something else I'm missing?

Or is my dev environment just having problems?
-jim


I don't understand why the pointer version works without the debugger so I
can't help you there. But boost::shared_ptr works fine with std::list in my
applications.

--
Cy
http://home.rochester.rr.com/cyhome/
Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.