Boost logo

Boost Users :

Subject: Re: [Boost-users] [Interprocess] Strange behaviour on erase in a b::i::vector of b::i::weak_ptr
From: Gaetan Gaumer (gaetan.gaumer_at_[hidden])
Date: 2010-12-17 04:24:20


Hello Ion,
did you look at the problem described bellow that I posted a few weeks ago.
Is it an Interprocess bug or my fault ?
Thanks for your help.
Gaëtan

2010/11/30 Gaetan Gaumer <gaetan.gaumer_at_[hidden]>:
> Hello Ion and others,
> I currently work with b::i::vectors storing b::i::managed_weak_ptr on
> objects created in a fixed_managed_shared_memory.
> I add shared_ptr whith push_back, but when I want to remove a weak_ptr
> using erase, the last item is erase instead of the
> one I want to remove.
> In the sample code below I add 3 objects and try to remove the middle
> one in both a vector of shared_ptr and a vector of weak_ptr :
> interprocessWeakVectorTest.cc http://pastebin.com/yDCngGw4
>
> The result is the expected one for vector of shared_ptr, but not for a
> vector of weak_ptr :
> foo_shared_vector:
> 1
> 3
> foo_weak_vector:
> 1
> 2
>
> A tried the same with std::vectors of boost::shared_ptr and
> boost::weak_ptr (sample code below) :
> weakVectorTest.cc  http://pastebin.com/fMEi0iaA
>
> The result is the expected one for both :
> foo_shared_vector:
> 1
> 3
> foo_weak_vector:
> 1
> 3
>
> I don't understand the behaviour of erase on b::i::vector of b::i::weak_ptr.
> Is this some kind of bug or am I doing something wrong ?
> For information I'm doing the same kind of thing with b::i::maps of
> b::i::shared_ptr and b::i::weak_ptr and the behaviour is correct.
>
> I compile this with : g++44 (GCC) 4.4.0 20090514 (Red Hat 4.4.0-6),
> and the 1.44 release of boost (but nothing in the 1.45 release note
> seems related to this),
> using options : -std=c++0x -lrt
>
> I don't know why but when I remove  -std=c++0x this do not compile
> anymore even if I don't think I use any c++0x feature (am I ?).
>
> Can you check this or explain me my error ?
> Thank you.
> 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