Boost logo

Boost Users :

Subject: Re: [Boost-users] [Interprocess] Problem with reserve for vector of weak_ptr
From: Gaetan Gaumer (gaetan.gaumer_at_[hidden])
Date: 2010-05-28 11:45:26


2010/5/27 Ion Gaztañaga <igaztanaga_at_[hidden]>:
> On 27/05/2010 18:44, Gaetan Gaumer wrote:
>>
>> Hello,
>> I'm currently trying to store shared_ptr to data in a vector in
>> fixed_managed_shared_memory.
>> The problem is that my program is crashing during a weak_ptr assignment.
>> Since the problem is difficult to explain, I designed a little example
>> which crash every time for me :
>
> I'll look into this but... shouldn't you "resize" instead of "reserve?

Resize can trim the vector and I don't want it.
I think "reserve" is the right function for my need.

When I use push_back instead of operator[] there is no pb.

For info I use gcc44 (don't have the version right now) on a 64b Linux.
Best regards,
Gaëtan


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net