This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Stateful allocators in libstdc++v [was: Re: Patch: stl_vector.h]


On Oct 21, 2004, at 11:00 PM, Dhruv Matani wrote:\

My favorite solution is that splicing or swapping between containers
with unequal allocators should be undefined behavior.  Howard Hinnant
argues that swap should be defined and should swap both the contents
and the allocators themselves.  (You may notice a potential
complication with that solution...)

Yes, but for swap() it seems fine.. The problem only seems to creep in when we apply the same logic to splice. I'm talking about applying solution(3) to swap here.

Then again for splice we can go with your solution about throwing, but
undefined behaviour seems a bit harsh to me ;-)

Then again, since an implementation has the liberty to choose O(N) or
O(1) size, wherein the complexity requirements for splice change, there,
they can go with option(2) which you have proposed. However, it
introduces a new situation wherein splice can throw!


All this probably out of the scope of this list. Maybe I'll start a
thread on comp.std?

Ok, I did a bit of googling, and this issue seems to have been discussed
quite widely already, thus not probably mandating another discussion.


The links for everyone's reference are:
http://groups.google.com/groups? q=swap+member+function+containers+swap+allocator&hl=en&lr=&selm=948vq8% 24vdf%241%40nnrp1.deja.com&rnum=7
http://groups.google.com/groups? q=swap+member+function+containers+swap+allocator&hl=en&lr=&selm=9a4jtg% 243lfso%241%40ID-62495.news.dfncis.de&rnum=3
http://groups.google.com/groups? q=swap+member+function+containers+swap+allocator&hl=en&lr=&selm=gridd -1407011016210001%40modemcable215.92-202-24.mtl.mc.videotron.ca&rnum=9
http://groups.google.com/groups? q=swap+member+function+containers+swap+allocator&hl=en&lr=&selm=XHMbc.3 0983%24jVF.981%40news04.bloor.is.net.cable.rogers.com&rnum=10
http://groups.google.com/groups? hl=en&lr=&threadm=948vq8%24vdf%241%40nnrp1.deja.com&rnum=7&prev=/ groups%3Fq%3Dswap%2Bmember%2Bfunction%2Bcontainers%2Bswap%2Ballocator%2 6hl%3Den%26lr%3D%26selm%3D948vq8%2524vdf%25241%2540nnrp1.deja.com%26rnu m%3D7


Matt, is a resolution forthcoming in the present meeting?


No. It's an open issue, it's related to a number of other open issues, and it was not discussed at the October '04 meeting.


--Matt


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]