473,411 Members | 1,982 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,411 software developers and data experts.

boost::shared_ptr inside stl::list

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
1 5880
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Philippe Guglielmetti | last post by:
I just ported old (VC6) working code to VC7.1 and have trouble with something like: class A; // forward typedef boost::smart_ptr<A> Aptr; class B{ Aptr a; virtual ~B(); // implemented...
4
by: Asapi | last post by:
class base { }; class d1 : public base { }; class d2 : public base {
5
by: ctick | last post by:
Are there any advantages of using boost::shared_ptr other than auto_ptr from standard library?
6
by: Vincent RICHOMME | last post by:
Hi, I have a question about STL lis, map... Let's say I have declared a list of pointer to object, when I call clear does it free all my objects ? Ex : typedef...
17
by: Allerdyce.John | last post by:
Hi, I am trying to compare the amount of work between using STL algorithm VS a plain Java loop. Let's say the class Rect has 2 attributes: area, and areaPerCent. In Java, I just write a...
6
by: Toby Bradshaw | last post by:
Hi, Consider the following: class A { public: virtual bool foo() = 0; };
1
by: Vincent RICHOMME | last post by:
Last question before to go to sleep : let's say I have a class derived from std::list template<typename T> class List : public std::list<T> { static bool const is_ptr = is_pointer<T>::value;...
2
by: zl2k | last post by:
hi, I have one program runs fine on my i386 linux box but get the "glibc detected *** corrupted double-linked list" error on the x86_64 linux box. Please help me to figure out if it is my...
1
by: =?ISO-8859-2?Q?Gordan_Kre=B9i=E6?= | last post by:
I have classic interface/implementation paradigm. That does not work with stl containers :) Call to doAbstract(derivedList) yelds compilation error: sample.cpp: In function 'int main(int,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.