Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #41262
| From | Juha Nieminen <nospam@thanks.invalid> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: do shared_ptrs to resized vector remain valid? |
| Date | 2016-02-26 18:08 +0000 |
| Organization | Netfront http://www.netfront.net/ |
| Message-ID | <naq4aq$b4$1@adenine.netfront.net> (permalink) |
| References | <5735d6ff-0572-41ff-ac88-8b1bcd52cef6@googlegroups.com> |
jomarbueyes@hotmail.com wrote: > I'm using a few shared pointers to a large vector that might be > resized (pointers to the vector itself, not to individual > elements). My question is: Do all the shared pointers still point to > the vector after it is resized? Thus far, it seems that they do with > g++ version 5.2.0. However, for portability I'd like to know what > the standard says. Do you mean a vector of shared_ptr's, or a vector of objects (and then those separate shared_ptr's pointing to said objects)? In the latter case all pointers and iterators get invalidated if the vector is resized larger. (Although I think that if you reserved a larger size and then resize the vector to be at most that size, they probably don't get invalidated.) --- news://freenews.netfront.net/ - complaints: news@netfront.net ---
Back to comp.lang.c++ | Previous | Next — Previous in thread | Find similar | Unroll thread
do shared_ptrs to resized vector remain valid? jomarbueyes@hotmail.com - 2016-02-26 07:41 -0800
Re: do shared_ptrs to resized vector remain valid? Paavo Helde <myfirstname@osa.pri.ee> - 2016-02-26 18:18 +0200
Re: do shared_ptrs to resized vector remain valid? legalize+jeeves@mail.xmission.com (Richard) - 2016-02-26 16:56 +0000
Re: do shared_ptrs to resized vector remain valid? jomarbueyes@hotmail.com - 2016-02-26 09:05 -0800
Re: do shared_ptrs to resized vector remain valid? jomarbueyes@hotmail.com - 2016-02-26 09:00 -0800
Re: do shared_ptrs to resized vector remain valid? Juha Nieminen <nospam@thanks.invalid> - 2016-02-26 18:08 +0000
csiph-web