Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #80243 > unrolled thread

Why does vector::reserve() not grow exponentially ?

Started byBonita Montero <Bonita.Montero@gmail.com>
First post2021-06-10 12:18 +0200
Last post2021-06-11 17:06 +0200
Articles 12 on this page of 252 — 51 participants

Back to article view | Back to comp.lang.c++


Contents

  Why does vector::reserve() not grow exponentially ? Bonita Montero <Bonita.Montero@gmail.com> - 2021-06-10 12:18 +0200
    Re: Why does vector::reserve() not grow exponentially ? Bo Persson <bo@bo-persson.se> - 2021-06-10 13:21 +0200
    Re: Why does vector::reserve() not grow exponentially ? Paavo Helde <myfirstname@osa.pri.ee> - 2021-06-10 14:37 +0300
      Re: Why does vector::reserve() not grow exponentially ? Bonita Montero <Bonita.Montero@gmail.com> - 2021-06-10 15:44 +0200
        Re: Why does vector::reserve() not grow exponentially ? David Brown <david.brown@hesbynett.no> - 2021-06-10 16:39 +0200
          Re: Why does vector::reserve() not grow exponentially ? Bonita Montero <Bonita.Montero@gmail.com> - 2021-06-10 16:47 +0200
            Re: Why does vector::reserve() not grow exponentially ? Bo Persson <bo@bo-persson.se> - 2021-06-10 22:00 +0200
              Re: Why does vector::reserve() not grow exponentially ? Bonita Montero <Bonita.Montero@gmail.com> - 2021-06-10 22:09 +0200
                Re: Why does vector::reserve() not grow exponentially         ? Sam <sam@email-scan.com> - 2021-06-11 06:57 -0400
                  Re: Why does vector::reserve() not grow exponentially ? Bonita Montero <Bonita.Montero@gmail.com> - 2021-06-11 13:16 +0200
                    Re: Why does vector::reserve() not grow exponentially ? Bo Persson <bo@bo-persson.se> - 2021-06-11 13:27 +0200
                      Re: Why does vector::reserve() not grow exponentially ? Bonita Montero <Bonita.Montero@gmail.com> - 2021-06-11 13:53 +0200
                        Re: Why does vector::reserve() not grow exponentially         ? Sam <sam@email-scan.com> - 2021-06-11 19:12 -0400
                          Re: Why does vector::reserve() not grow exponentially ? Bonita Montero <Bonita.Montero@gmail.com> - 2021-06-12 04:09 +0200
                            Re: Why does vector::reserve() not grow exponentially         ? Sam <sam@email-scan.com> - 2021-06-12 08:50 -0400
                              Re: Why does vector::reserve() not grow exponentially ? Bonita Montero <Bonita.Montero@gmail.com> - 2021-06-12 15:43 +0200
                                Re: Why does vector::reserve() not grow exponentially         ? Sam <sam@email-scan.com> - 2021-06-12 18:59 -0400
                                  Re: Why does vector::reserve() not grow exponentially ? Bonita Montero <Bonita.Montero@gmail.com> - 2021-06-13 07:31 +0200
                                    Re: Why does vector::reserve() not grow exponentially         ? Sam <sam@email-scan.com> - 2021-06-13 08:09 -0400
                                      Re: Why does vector::reserve() not grow exponentially ? Bonita Montero <Bonita.Montero@gmail.com> - 2021-06-13 14:12 +0200
                                        Re: Why does vector::reserve() not grow exponentially         ? Sam <sam@email-scan.com> - 2021-06-13 09:50 -0400
                                          Re: Why does vector::reserve() not grow exponentially ? Bonita Montero <Bonita.Montero@gmail.com> - 2021-06-13 16:05 +0200
                                            Re: Why does vector::reserve() not grow exponentially         ? Sam <sam@email-scan.com> - 2021-06-13 11:23 -0400
                                              Re: Why does vector::reserve() not grow exponentially ? Bonita Montero <Bonita.Montero@gmail.com> - 2021-06-13 18:56 +0200
                                                Re: Why does vector::reserve() not grow exponentially         ? Sam <sam@email-scan.com> - 2021-06-13 13:37 -0400
                                                  Re: Why does vector::reserve() not grow exponentially ? Bonita Montero <Bonita.Montero@gmail.com> - 2021-06-14 05:16 +0200
                                                    Re: Why does vector::reserve() not grow exponentially         ? Sam <sam@email-scan.com> - 2021-06-14 07:00 -0400
                                  Re: Why does vector::reserve() not grow exponentially MrSpook_t0Y6kgpd5@3dryi7no.gov - 2021-06-13 08:39 +0000
                    Re: Why does vector::reserve() not grow exponentially         ? Sam <sam@email-scan.com> - 2021-06-11 19:11 -0400
                      Re: Why does vector::reserve() not grow exponentially ? Bonita Montero <Bonita.Montero@gmail.com> - 2021-06-12 04:10 +0200
                        Re: Why does vector::reserve() not grow exponentially ? Öö Tiib <ootiib@hot.ee> - 2021-06-11 22:18 -0700
                          Re: Why does vector::reserve() not grow exponentially ? Bonita Montero <Bonita.Montero@gmail.com> - 2021-06-12 08:18 +0200
                            Re: Why does vector::reserve() not grow exponentially ? Öö Tiib <ootiib@hot.ee> - 2021-06-12 01:43 -0700
                              Re: Why does vector::reserve() not grow exponentially ? Bonita Montero <Bonita.Montero@gmail.com> - 2021-06-12 11:00 +0200
                                Re: Why does vector::reserve() not grow exponentially ? Öö Tiib <ootiib@hot.ee> - 2021-06-12 02:04 -0700
                                  Re: Why does vector::reserve() not grow exponentially ? Bonita Montero <Bonita.Montero@gmail.com> - 2021-06-12 11:15 +0200
                                    Re: Why does vector::reserve() not grow exponentially ? Öö Tiib <ootiib@hot.ee> - 2021-06-12 02:24 -0700
                                      Re: Why does vector::reserve() not grow exponentially ? Bonita Montero <Bonita.Montero@gmail.com> - 2021-06-12 11:30 +0200
                                        Re: Why does vector::reserve() not grow exponentially ? "Alf P. Steinbach" <alf.p.steinbach@gmail.com> - 2021-06-12 12:59 +0200
                                          Re: Why does vector::reserve() not grow exponentially ? Bonita Montero <Bonita.Montero@gmail.com> - 2021-06-12 13:27 +0200
                                          Re: Why does vector::reserve() not grow exponentially ? Bonita Montero <Bonita.Montero@gmail.com> - 2021-06-12 13:19 +0200
                                            Re: Why does vector::reserve() not grow exponentially ? "Alf P. Steinbach" <alf.p.steinbach@gmail.com> - 2021-06-12 13:30 +0200
                                              Re: Why does vector::reserve() not grow exponentially ? Bonita Montero <Bonita.Montero@gmail.com> - 2021-06-12 13:39 +0200
                                            Re: Why does vector::reserve() not grow exponentially ? David Brown <david.brown@hesbynett.no> - 2021-06-12 14:04 +0200
                                              Re: Why does vector::reserve() not grow exponentially ? Bonita Montero <Bonita.Montero@gmail.com> - 2021-06-12 15:30 +0200
                                        Re: Why does vector::reserve() not grow exponentially         ? Sam <sam@email-scan.com> - 2021-06-12 08:53 -0400
                                          Re: Why does vector::reserve() not grow exponentially ? Bonita Montero <Bonita.Montero@gmail.com> - 2021-06-12 15:31 +0200
                                            Re: Why does vector::reserve() not grow exponentially         ? Sam <sam@email-scan.com> - 2021-06-12 18:43 -0400
                                              Re: Why does vector::reserve() not grow exponentially ? Bonita Montero <Bonita.Montero@gmail.com> - 2021-06-13 07:31 +0200
                                                Re: Why does vector::reserve() not grow exponentially ? Richard Damon <Richard@Damon-Family.org> - 2021-06-13 07:48 -0400
                                                  Re: Why does vector::reserve() not grow exponentially ? Bonita Montero <Bonita.Montero@gmail.com> - 2021-06-13 14:03 +0200
                                                    Re: Why does vector::reserve() not grow exponentially ? Bonita Montero <Bonita.Montero@gmail.com> - 2021-06-13 14:12 +0200
                                                      Re: Why does vector::reserve() not grow exponentially         ? Sam <sam@email-scan.com> - 2021-06-13 11:21 -0400
                                                        Re: Why does vector::reserve() not grow exponentially ? Bonita Montero <Bonita.Montero@gmail.com> - 2021-06-13 18:55 +0200
                                                          Re: Why does vector::reserve() not grow exponentially         ? Sam <sam@email-scan.com> - 2021-06-13 13:38 -0400
                                                            Re: Why does vector::reserve() not grow exponentially ? Bonita Montero <Bonita.Montero@gmail.com> - 2021-06-14 05:18 +0200
                                                              Re: Why does vector::reserve() not grow exponentially         ? Sam <sam@email-scan.com> - 2021-06-14 07:00 -0400
                                                                Re: Why does vector::reserve() not grow exponentially ? Bonita Montero <Bonita.Montero@gmail.com> - 2021-06-14 13:08 +0200
                                                                  Re: Why does vector::reserve() not grow exponentially         ? Sam <sam@email-scan.com> - 2021-06-14 18:35 -0400
                                                                    Re: Why does vector::reserve() not grow exponentially ? Öö Tiib <ootiib@hot.ee> - 2021-06-14 22:49 -0700
                                                                      Re: Why does vector::reserve() not grow exponentially         ? Sam <sam@email-scan.com> - 2021-06-15 08:11 -0400
                                                                        Re: Why does vector::reserve() not grow exponentially MrSpook_ka1o_g@otuej9sdvqn8a4.gov.uk - 2021-06-15 12:54 +0000
                                                                          Re: Why does vector::reserve() not grow exponentially "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-06-15 13:09 -0700
                                                                            Re: Why does vector::reserve() not grow exponentially MrSpook_b1My5@751smt.edu - 2021-06-16 08:44 +0000
                                                                              Re: Why does vector::reserve() not grow exponentially Paavo Helde <myfirstname@osa.pri.ee> - 2021-06-16 13:11 +0300
                                                                                Re: Why does vector::reserve() not grow exponentially MrSpook_p6g@ktmy0vg8lj7jxt.biz - 2021-06-16 10:21 +0000
                                                                                  Re: Why does vector::reserve() not grow exponentially Sam <sam@email-scan.com> - 2021-06-16 06:41 -0400
                                                                                    Re: Why does vector::reserve() not grow exponentially MrSpook_F2ryro5_b@ugk_rvxkkm.gov - 2021-06-16 11:11 +0000
                                                                                      Re: Why does vector::reserve() not grow exponentially Sam <sam@email-scan.com> - 2021-06-16 08:25 -0400
                                                                                        Re: Why does vector::reserve() not grow exponentially Paavo Helde <myfirstname@osa.pri.ee> - 2021-06-16 16:10 +0300
                                                                                        Re: Why does vector::reserve() not grow exponentially David Brown <david.brown@hesbynett.no> - 2021-06-16 15:59 +0200
                                                                                        Re: Why does vector::reserve() not grow exponentially MrSpook_ucGx3e4l@x8gqtuqjwl9z3g.com - 2021-06-16 13:47 +0000
                                                                                      Re: Why does vector::reserve() not grow exponentially scott@slp53.sl.home (Scott Lurndal) - 2021-06-16 15:09 +0000
                                                                                        Re: Why does vector::reserve() not grow exponentially Bonita Montero <Bonita.Montero@gmail.com> - 2021-06-16 17:50 +0200
                                                                                        Re: Why does vector::reserve() not grow exponentially MrSpook_hjesjs@8pot25r5sg1xe.info - 2021-06-16 15:45 +0000
                                                                                          Re: Why does vector::reserve() not grow exponentially Paavo Helde <myfirstname@osa.pri.ee> - 2021-06-16 21:08 +0300
                                                                                            Re: Why does vector::reserve() not grow exponentially scott@slp53.sl.home (Scott Lurndal) - 2021-06-16 19:06 +0000
                                                                                    Re: Why does vector::reserve() not grow exponentially Juha Nieminen <nospam@thanks.invalid> - 2021-06-16 13:09 +0000
                                                                      Re: Why does vector::reserve() not grow exponentially ? Manfred <noname@add.invalid> - 2021-06-15 20:30 +0200
                                                                      Re: Why does vector::reserve() not grow exponentially ? Juha Nieminen <nospam@thanks.invalid> - 2021-06-16 04:33 +0000
                                                                        Re: Why does vector::reserve() not grow exponentially ? David Brown <david.brown@hesbynett.no> - 2021-06-16 10:35 +0200
                                                                          Re: Why does vector::reserve() not grow exponentially ? David Brown <david.brown@hesbynett.no> - 2021-06-16 11:18 +0200
                                                                            Re: Why does vector::reserve() not grow exponentially ? MrSpook_u_kch7_3@abbbp5z5c0iw8rwgxg4.gov - 2021-06-16 09:34 +0000
                                                                              Re: Why does vector::reserve() not grow exponentially ? David Brown <david.brown@hesbynett.no> - 2021-06-16 11:53 +0200
                                                                                Re: Why does vector::reserve() not grow exponentially ? MrSpook_ge@ldwlviy1f9uwd19thc.gov - 2021-06-16 10:19 +0000
                                                                                  Re: Why does vector::reserve() not grow exponentially ? David Brown <david.brown@hesbynett.no> - 2021-06-16 13:09 +0200
                                                                          Re: Why does vector::reserve() not grow exponentially ? MrSpook_3_fdyox@sg5nvjmv741xbigdp6.info - 2021-06-16 09:04 +0000
                                                                            Re: Why does vector::reserve() not grow exponentially ? Juha Nieminen <nospam@thanks.invalid> - 2021-06-16 09:20 +0000
                                                                          Re: Why does vector::reserve() not grow exponentially ? Tim Woodall <news001@woodall.me.uk> - 2021-06-16 09:49 +0000
                                                                            Re: Why does vector::reserve() not grow exponentially ? David Brown <david.brown@hesbynett.no> - 2021-06-16 13:14 +0200
                                                                              Re: Why does vector::reserve() not grow exponentially ? MrSpook_G1Sw6pdcqz@5a69.edu - 2021-06-16 11:25 +0000
                                                                                Re: Why does vector::reserve() not grow exponentially ? David Brown <david.brown@hesbynett.no> - 2021-06-16 14:43 +0200
                                                                                  Re: Why does vector::reserve() not grow exponentially ? David Brown <david.brown@hesbynett.no> - 2021-06-16 14:44 +0200
                                                                                    Re: Why does vector::reserve() not grow exponentially ? MrSpook_g3w@2ur2yrijxtw7d3jt394yu9dp.org - 2021-06-16 13:48 +0000
                                                                                      Re: Why does vector::reserve() not grow exponentially ? David Brown <david.brown@hesbynett.no> - 2021-06-16 16:07 +0200
                                                                                  Re: Why does vector::reserve() not grow exponentially ? MrSpook_74D@ov88_wt8h.co.uk - 2021-06-16 13:54 +0000
                                                                                    Re: Why does vector::reserve() not grow exponentially ? David Brown <david.brown@hesbynett.no> - 2021-06-16 19:55 +0200
                                                                              Re: Why does vector::reserve() not grow exponentially ? Juha Nieminen <nospam@thanks.invalid> - 2021-06-16 13:14 +0000
                                                                              Re: Why does vector::reserve() not grow exponentially ? James Kuyper <jameskuyper@alumni.caltech.edu> - 2021-06-16 10:38 -0400
                                                                                Re: Why does vector::reserve() not grow exponentially ? David Brown <david.brown@hesbynett.no> - 2021-06-16 19:58 +0200
                                                                          Re: Why does vector::reserve() not grow exponentially ? "daniel...@gmail.com" <danielaparker@gmail.com> - 2021-06-17 13:45 -0700
                                                                            Re: Why does vector::reserve() not grow exponentially ? Real Troll <real.troll@trolls.com> - 2021-06-17 21:15 +0000
                                                                              Re: Why does vector::reserve() not grow exponentially ? Manfred <noname@add.invalid> - 2021-06-18 15:23 +0200
                                                                            Re: Why does vector::reserve() not grow exponentially ? David Brown <david.brown@hesbynett.no> - 2021-06-18 08:56 +0200
                                                                              Re: Why does vector::reserve() not grow exponentially ? "daniel...@gmail.com" <danielaparker@gmail.com> - 2021-06-18 08:06 -0700
                                                                                Re: Why does vector::reserve() not grow exponentially ? David Brown <david.brown@hesbynett.no> - 2021-06-18 17:41 +0200
                                                                                  Re: Why does vector::reserve() not grow exponentially ? "daniel...@gmail.com" <danielaparker@gmail.com> - 2021-06-18 14:31 -0700
                                                                                    Re: Why does vector::reserve() not grow exponentially ? Öö Tiib <ootiib@hot.ee> - 2021-06-19 02:53 -0700
                                                                                  Re: Why does vector::reserve() not grow exponentially ? Ian Collins <ian-news@hotmail.com> - 2021-06-19 11:10 +1200
                                                                                Re: Why does vector::reserve() not grow exponentially ? MrSpook_gavL@es9w71p.tv - 2021-06-18 15:53 +0000
                                                                                  Re: Why does vector::reserve() not grow exponentially ? scott@slp53.sl.home (Scott Lurndal) - 2021-06-18 16:06 +0000
                                                                            Re: Why does vector::reserve() not grow exponentially ? MrSpook_Zp_@opm5ve6jyhq.ac.uk - 2021-06-18 09:22 +0000
                                                                        Re: Why does vector::reserve() not grow exponentially ? Öö Tiib <ootiib@hot.ee> - 2021-06-16 04:55 -0700
                                                                          Re: Why does vector::reserve() not grow exponentially ? Juha Nieminen <nospam@thanks.invalid> - 2021-06-16 13:16 +0000
                                                                            Re: Why does vector::reserve() not grow exponentially ? Öö Tiib <ootiib@hot.ee> - 2021-06-16 11:03 -0700
                                                                              Re: Why does vector::reserve() not grow exponentially ? Juha Nieminen <nospam@thanks.invalid> - 2021-06-17 05:35 +0000
                                                                                Re: Why does vector::reserve() not grow exponentially ? Öö Tiib <ootiib@hot.ee> - 2021-06-17 16:51 -0700
                                                                                  Re: Why does vector::reserve() not grow exponentially         ? Sam <sam@email-scan.com> - 2021-06-17 20:19 -0400
                                                                                    Re: Why does vector::reserve() not grow exponentially ? Öö Tiib <ootiib@hot.ee> - 2021-06-17 18:22 -0700
                                                                                      Re: Why does vector::reserve() not grow exponentially ? MrSpook_6a2az@yxcggolr9p.com - 2021-06-18 09:24 +0000
                                                                                        Re: Why does vector::reserve() not grow exponentially         ? Sam <sam@email-scan.com> - 2021-06-18 08:20 -0400
                                                                                          Re: Why does vector::reserve() not grow exponentially ? David Brown <david.brown@hesbynett.no> - 2021-06-18 15:38 +0200
                                                                                            Re: Why does vector::reserve() not grow exponentially         ? Sam <sam@email-scan.com> - 2021-06-18 18:01 -0400
                                                                                              Re: Why does vector::reserve() not grow exponentially ? David Brown <david.brown@hesbynett.no> - 2021-06-19 12:32 +0200
                                                                                                Re: Why does vector::reserve() not grow exponentially         ? Sam <sam@email-scan.com> - 2021-06-19 09:12 -0400
                                                                                                  Re: Why does vector::reserve() not grow exponentially ? David Brown <david.brown@hesbynett.no> - 2021-06-19 15:24 +0200
                                                                                                    Re: Why does vector::reserve() not grow exponentially         ? Sam <sam@email-scan.com> - 2021-06-19 17:33 -0400
                                                                                                      Re: Why does vector::reserve() not grow exponentially ? David Brown <david.brown@hesbynett.no> - 2021-06-20 09:45 +0200
                                                                                              Re: Why does vector::reserve() not grow exponentially ? Öö Tiib <ootiib@hot.ee> - 2021-06-19 03:33 -0700
                                                                                                Re: Why does vector::reserve() not grow exponentially         ? Sam <sam@email-scan.com> - 2021-06-19 09:38 -0400
                                                                                                  Re: Why does vector::reserve() not grow exponentially ? Öö Tiib <ootiib@hot.ee> - 2021-06-19 12:50 -0700
                                                                                                    Re: Why does vector::reserve() not grow exponentially         ? Sam <sam@email-scan.com> - 2021-06-19 17:46 -0400
                                                                                                      Re: Why does vector::reserve() not grow exponentially ? Öö Tiib <ootiib@hot.ee> - 2021-06-20 05:19 -0700
                                                                                                  Re: Why does vector::reserve() not grow exponentially ? Paavo Helde <myfirstname@osa.pri.ee> - 2021-06-19 23:27 +0300
                                                                                                    Re: Why does vector::reserve() not grow exponentially         ? Sam <sam@email-scan.com> - 2021-06-19 17:50 -0400
                                                                                                  Re: Why does vector::reserve() not grow exponentially ? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-06-19 16:44 -0700
                                                                                          Re: Why does vector::reserve() not grow exponentially ? Paavo Helde <myfirstname@osa.pri.ee> - 2021-06-18 17:46 +0300
                                                                                            Re: Why does vector::reserve() not grow exponentially         ? Sam <sam@email-scan.com> - 2021-06-18 17:41 -0400
                                                                                              Re: Why does vector::reserve() not grow exponentially ? Paavo Helde <myfirstname@osa.pri.ee> - 2021-06-19 11:21 +0300
                                                                                                Re: Why does vector::reserve() not grow exponentially         ? Sam <sam@email-scan.com> - 2021-06-19 09:08 -0400
                                                                                                  Re: Why does vector::reserve() not grow exponentially ? Paavo Helde <myfirstname@osa.pri.ee> - 2021-06-20 21:09 +0300
                                                                                                    Re: Why does vector::reserve() not grow exponentially ? Öö Tiib <ootiib@hot.ee> - 2021-06-20 11:59 -0700
                                                                                                    Re: Why does vector::reserve() not grow exponentially ? Paavo Helde <myfirstname@osa.pri.ee> - 2021-06-20 22:02 +0300
                                                                                                    Re: Why does vector::reserve() not grow exponentially ? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-06-20 14:56 -0700
                                                                                                      Re: Why does vector::reserve() not grow exponentially ? Paavo Helde <myfirstname@osa.pri.ee> - 2021-06-21 09:22 +0300
                                                                                                        Re: Why does vector::reserve() not grow exponentially ? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-06-21 16:46 -0700
                                                                                                          Re: Why does vector::reserve() not grow exponentially ? Paavo Helde <myfirstname@osa.pri.ee> - 2021-06-22 10:56 +0300
                                                                                                            Re: Why does vector::reserve() not grow exponentially ? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-06-22 12:49 -0700
                                                                                                              Re: Why does vector::reserve() not grow exponentially ? Paavo Helde <myfirstname@osa.pri.ee> - 2021-06-23 01:36 +0300
                                                                                                                Re: Why does vector::reserve() not grow exponentially ? scott@slp53.sl.home (Scott Lurndal) - 2021-06-23 14:32 +0000
                                                                                                                  Re: Why does vector::reserve() not grow exponentially ? David Brown <david.brown@hesbynett.no> - 2021-06-23 16:55 +0200
                                                                                                                  Re: Why does vector::reserve() not grow exponentially ? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-06-24 16:13 -0700
                                                                                                                    Re: Why does vector::reserve() not grow exponentially ? scott@slp53.sl.home (Scott Lurndal) - 2021-06-25 14:34 +0000
                                                                                                                      Re: Why does vector::reserve() not grow exponentially ? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-06-25 12:16 -0700
                                                                                                              Re: Why does vector::reserve() not grow exponentially ? Öö Tiib <ootiib@hot.ee> - 2021-06-22 15:36 -0700
                                                                                                                Re: Why does vector::reserve() not grow exponentially ? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-06-24 16:09 -0700
                                                                                                        Re: Why does vector::reserve() not grow exponentially ? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-06-21 17:12 -0700
                                                                                                    Re: Why does vector::reserve() not grow exponentially         ? Sam <sam@email-scan.com> - 2021-06-20 19:03 -0400
                                                                                                      Re: Why does vector::reserve() not grow exponentially ? Paavo Helde <myfirstname@osa.pri.ee> - 2021-06-21 09:52 +0300
                                                                                  Re: Why does vector::reserve() not grow exponentially ? red floyd <no.spam.here@its.invalid> - 2021-06-18 00:18 -0700
                                                                                    Re: Why does vector::reserve() not grow exponentially ? Öö Tiib <ootiib@hot.ee> - 2021-06-18 02:06 -0700
                                                                                      Re: Why does vector::reserve() not grow exponentially ? Juha Nieminen <nospam@thanks.invalid> - 2021-06-21 12:43 +0000
                                                                                        Re: Why does vector::reserve() not grow exponentially ? Chris Vine <chris@cvine--nospam--.freeserve.co.uk> - 2021-06-21 22:48 +0100
                                                                                          Re: Why does vector::reserve() not grow exponentially ? Juha Nieminen <nospam@thanks.invalid> - 2021-06-22 05:30 +0000
                                                                                            Re: Why does vector::reserve() not grow exponentially ? Öö Tiib <ootiib@hot.ee> - 2021-06-21 23:12 -0700
                                                                                              Re: Why does vector::reserve() not grow exponentially ? MrSpook_D_a3U17y@j_az.net - 2021-06-22 07:14 +0000
                                                                                                Re: Why does vector::reserve() not grow exponentially ? Manfred <noname@add.invalid> - 2021-06-22 13:49 +0200
                                                                                              Re: Why does vector::reserve() not grow exponentially ? Juha Nieminen <nospam@thanks.invalid> - 2021-06-22 08:03 +0000
                                                                                                Re: Why does vector::reserve() not grow exponentially ? Öö Tiib <ootiib@hot.ee> - 2021-06-22 01:28 -0700
                                                                                                  Re: Why does vector::reserve() not grow exponentially ? Juha Nieminen <nospam@thanks.invalid> - 2021-06-23 06:19 +0000
                                                                                                    Re: Why does vector::reserve() not grow exponentially ? Öö Tiib <ootiib@hot.ee> - 2021-06-23 04:18 -0700
                                                                                  Re: Why does vector::reserve() not grow exponentially ? Juha Nieminen <nospam@thanks.invalid> - 2021-06-21 12:39 +0000
                                                                    Re: Why does vector::reserve() not grow exponentially ? Bonita Montero <Bonita.Montero@gmail.com> - 2021-06-15 08:01 +0200
                                                                      Re: Why does vector::reserve() not grow exponentially         ? Sam <sam@email-scan.com> - 2021-06-15 08:12 -0400
                                                                        Re: Why does vector::reserve() not grow exponentially ? Bonita Montero <Bonita.Montero@gmail.com> - 2021-06-15 15:34 +0200
                                                                          Re: Why does vector::reserve() not grow exponentially         ? Sam <sam@email-scan.com> - 2021-06-15 17:37 -0400
                                                                            Re: Why does vector::reserve() not grow exponentially ? Bonita Montero <Bonita.Montero@gmail.com> - 2021-06-16 02:17 +0200
                                                                              Re: Why does vector::reserve() not grow exponentially         ? Sam <sam@email-scan.com> - 2021-06-15 21:11 -0400
                                                                                Re: Why does vector::reserve() not grow exponentially ? Bonita Montero <Bonita.Montero@gmail.com> - 2021-06-16 07:09 +0200
                                                                                  Re: Why does vector::reserve() not grow exponentially         ? Sam <sam@email-scan.com> - 2021-06-16 06:37 -0400
                                                                                    Re: Why does vector::reserve() not grow exponentially ? Bonita Montero <Bonita.Montero@gmail.com> - 2021-06-16 13:01 +0200
                                                                                      Re: Why does vector::reserve() not grow exponentially         ? Sam <sam@email-scan.com> - 2021-06-16 08:16 -0400
                                                                                        Re: Why does vector::reserve() not grow exponentially ? Bonita Montero <Bonita.Montero@gmail.com> - 2021-06-16 15:35 +0200
                                                                                          Re: Why does vector::reserve() not grow exponentially         ? Sam <sam@email-scan.com> - 2021-06-16 17:40 -0400
                                                                                  Re: Why does vector::reserve() not grow exponentially ? Bonita Montero <Bonita.Montero@gmail.com> - 2021-06-16 13:40 +0200
                                                                                    Re: Why does vector::reserve() not grow exponentially ? Paavo Helde <myfirstname@osa.pri.ee> - 2021-06-16 18:10 +0300
                                                                                  Re: Why does vector::reserve() not grow exponentially ? Paavo Helde <myfirstname@osa.pri.ee> - 2021-06-16 14:37 +0300
                                                                                  Re: Why does vector::reserve() not grow exponentially ? scott@slp53.sl.home (Scott Lurndal) - 2021-06-16 15:04 +0000
                                                                                    Re: Why does vector::reserve() not grow exponentially ? Bonita Montero <Bonita.Montero@gmail.com> - 2021-06-16 17:37 +0200
                                                                                      Re: Why does vector::reserve() not grow exponentially         ? Sam <sam@email-scan.com> - 2021-06-16 17:40 -0400
                                                                                        Re: Why does vector::reserve() not grow exponentially ? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-06-16 16:25 -0700
                                                                                          Re: Why does vector::reserve() not grow exponentially         ? Sam <sam@email-scan.com> - 2021-06-16 23:17 -0400
                                                                                            Re: Why does vector::reserve() not grow exponentially ? David Brown <david.brown@hesbynett.no> - 2021-06-17 09:22 +0200
                                                                                              Re: Why does vector::reserve() not grow exponentially ? MrSpook_e0mt@hszpo62mi.com - 2021-06-17 08:31 +0000
                                                                                        Re: Why does vector::reserve() not grow exponentially ? Bonita Montero <Bonita.Montero@gmail.com> - 2021-06-17 07:11 +0200
                                                                                          Re: Why does vector::reserve() not grow exponentially         ? Sam <sam@email-scan.com> - 2021-06-17 09:24 -0400
                                                                                            Re: Why does vector::reserve() not grow exponentially ? Bonita Montero <Bonita.Montero@gmail.com> - 2021-06-17 16:43 +0200
                                                    Re: Why does vector::reserve() not grow exponentially         ? Sam <sam@email-scan.com> - 2021-06-13 08:11 -0400
                                                Re: Why does vector::reserve() not grow exponentially         ? Sam <sam@email-scan.com> - 2021-06-13 08:10 -0400
                                      Re: Why does vector::reserve() not grow exponentially ? David Brown <david.brown@hesbynett.no> - 2021-06-12 14:01 +0200
                                        Re: Why does vector::reserve() not grow exponentially ? Bonita Montero <Bonita.Montero@gmail.com> - 2021-06-12 15:34 +0200
                                      Re: Why does vector::reserve() not grow exponentially ? Ian Collins <ian-news@hotmail.com> - 2021-06-13 13:01 +1200
                                        Re: Why does vector::reserve() not grow exponentially ? Öö Tiib <ootiib@hot.ee> - 2021-06-13 07:39 -0700
                            Re: Why does vector::reserve() not grow exponentially ? Bo Persson <bo@bo-persson.se> - 2021-06-12 10:51 +0200
                              Re: Why does vector::reserve() not grow exponentially ? Bonita Montero <Bonita.Montero@gmail.com> - 2021-06-12 11:03 +0200
                                Re: Why does vector::reserve() not grow exponentially ? Bo Persson <bo@bo-persson.se> - 2021-06-12 13:07 +0200
                                  Re: Why does vector::reserve() not grow exponentially ? Bonita Montero <Bonita.Montero@gmail.com> - 2021-06-12 13:22 +0200
                            Re: Why does vector::reserve() not grow exponentially         ? Sam <sam@email-scan.com> - 2021-06-12 08:52 -0400
              Re: Why does vector::reserve() not grow exponentially ? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-06-10 16:51 -0700
            Re: Why does vector::reserve() not grow exponentially ? David Brown <david.brown@hesbynett.no> - 2021-06-11 09:52 +0200
              Re: Why does vector::reserve() not grow exponentially ? Bonita Montero <Bonita.Montero@gmail.com> - 2021-06-11 13:17 +0200
                Re: Why does vector::reserve() not grow exponentially ? David Brown <david.brown@hesbynett.no> - 2021-06-11 13:45 +0200
                  Re: Why does vector::reserve() not grow exponentially ? Bonita Montero <Bonita.Montero@gmail.com> - 2021-06-11 13:54 +0200
                    Re: Why does vector::reserve() not grow exponentially ? David Brown <david.brown@hesbynett.no> - 2021-06-11 15:58 +0200
                      Re: Why does vector::reserve() not grow exponentially ? Bonita Montero <Bonita.Montero@gmail.com> - 2021-06-11 16:35 +0200
                        Re: Why does vector::reserve() not grow exponentially ? Manfred <noname@add.invalid> - 2021-06-11 17:11 +0200
                          Re: Why does vector::reserve() not grow exponentially ? Bonita Montero <Bonita.Montero@gmail.com> - 2021-06-11 17:12 +0200
                        Re: Why does vector::reserve() not grow exponentially ? Christian Gollwitzer <auriocus@gmx.de> - 2021-06-11 21:15 +0200
                    Re: Why does vector::reserve() not grow exponentially ? Bo Persson <bo@bo-persson.se> - 2021-06-11 21:58 +0200
                      Re: Why does vector::reserve() not grow exponentially ? Bonita Montero <Bonita.Montero@gmail.com> - 2021-06-12 04:11 +0200
            Re: Why does vector::reserve() not grow exponentially         ? Sam <sam@email-scan.com> - 2021-06-11 06:55 -0400
              Re: Why does vector::reserve() not grow exponentially ? Bonita Montero <Bonita.Montero@gmail.com> - 2021-06-11 13:19 +0200
          Re: Why does vector::reserve() not grow exponentially ? Bonita Montero <Bonita.Montero@gmail.com> - 2021-06-10 16:51 +0200
          Re: Why does vector::reserve() not grow exponentially ? MrSpook_sw@08_cl170xu11o4f8xcg45.co.uk - 2021-06-10 15:25 +0000
            Re: Why does vector::reserve() not grow exponentially ? Bonita Montero <Bonita.Montero@gmail.com> - 2021-06-10 18:18 +0200
            Re: Why does vector::reserve() not grow exponentially ? Paavo Helde <myfirstname@osa.pri.ee> - 2021-06-10 22:40 +0300
              Re: Why does vector::reserve() not grow exponentially ? "Alf P. Steinbach" <alf.p.steinbach@gmail.com> - 2021-06-10 22:35 +0200
                Re: Why does vector::reserve() not grow exponentially ? Paavo Helde <myfirstname@osa.pri.ee> - 2021-06-11 09:23 +0300
                  Re: Why does vector::reserve() not grow exponentially ? Bo Persson <bo@bo-persson.se> - 2021-06-11 12:02 +0200
                    Re: Why does vector::reserve() not grow exponentially ? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-06-11 03:05 -0700
                      Re: Why does vector::reserve() not grow exponentially ? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-06-11 03:22 -0700
                      Re: Why does vector::reserve() not grow exponentially ? "Alf P. Steinbach" <alf.p.steinbach@gmail.com> - 2021-06-11 12:25 +0200
                        Re: Why does vector::reserve() not grow exponentially ? MrSpook_4421gcxq@fceufv2.ac.uk - 2021-06-11 11:39 +0000
                      Re: Why does vector::reserve() not grow exponentially ? MrSpook_3wcC2u9@cns8.net - 2021-06-11 10:18 +0000
                    Re: Why does vector::reserve() not grow exponentially ? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-06-11 03:27 -0700
                    Re: Why does vector::reserve() not grow exponentially ? MrSpook_4bkzrb03@tu45utvus6nuc.tv - 2021-06-11 10:17 +0000
                      Re: Why does vector::reserve() not grow exponentially ? Manfred <noname@add.invalid> - 2021-06-11 13:22 +0200
                        Re: Why does vector::reserve() not grow exponentially ? MrSpook_0nG@p900whw6_n8r7ovwuul.ac.uk - 2021-06-11 11:34 +0000
                          Re: Why does vector::reserve() not grow exponentially ? Manfred <noname@add.invalid> - 2021-06-11 14:14 +0200
                            Re: Why does vector::reserve() not grow exponentially ? MrSpook_p_5Ko4g@21yhpi_n4fck_wfz.org - 2021-06-11 12:50 +0000
                  Re: Why does vector::reserve() not grow exponentially ? MrSpook_0sk4i3p@b1km5k73i1.edu - 2021-06-11 09:24 +0000
                    Re: Why does vector::reserve() not grow exponentially ? Paavo Helde <myfirstname@osa.pri.ee> - 2021-06-11 14:18 +0300
              Re: Why does vector::reserve() not grow exponentially ? Bo Persson <bo@bo-persson.se> - 2021-06-11 11:59 +0200
                Re: Why does vector::reserve() not grow exponentially ? MrSpook_jyc2xeWf9@aw55u6.gov - 2021-06-11 10:17 +0000
              Re: Why does vector::reserve() not grow exponentially ? MrSpook_3dnim@5ooodqy.co.uk - 2021-06-11 09:19 +0000
                Re: Why does vector::reserve() not grow exponentially ? Paavo Helde <myfirstname@osa.pri.ee> - 2021-06-11 14:26 +0300
                  Re: Why does vector::reserve() not grow exponentially ? MrSpook_35@s879vvmwpgee7rpqv.net - 2021-06-11 11:38 +0000
                    Re: Why does vector::reserve() not grow exponentially ? Paavo Helde <myfirstname@osa.pri.ee> - 2021-06-11 15:14 +0300
                      Re: Why does vector::reserve() not grow exponentially ? MrSpook_uQjuVe@5szcyauh_pjzi228wvwn.info - 2021-06-11 12:52 +0000
                        Re: Why does vector::reserve() not grow exponentially ? Paavo Helde <myfirstname@osa.pri.ee> - 2021-06-11 16:37 +0300
                          Re: Why does vector::reserve() not grow exponentially ? MrSpook_9fpRQm@i1z834r.net - 2021-06-11 14:58 +0000
                          Re: Why does vector::reserve() not grow exponentially ? Manfred <noname@add.invalid> - 2021-06-11 17:06 +0200

Page 13 of 13 — ← Prev page 1 … 11 12 [13]


#80284

FromMrSpook_0sk4i3p@b1km5k73i1.edu
Date2021-06-11 09:24 +0000
Message-ID<s9va46$1nhq$1@gioia.aioe.org>
In reply to#80273
On Fri, 11 Jun 2021 09:23:54 +0300
Paavo Helde <myfirstname@osa.pri.ee> wrote:
>Mr Spook wrote: "allowing a valid [] access into the reserved but
>uninitialised indexes".
>
>The operator[] is easy to check for an implementation. Indeed, VS2019 in 
>Debug mode with default options pops up a "Debug assertion failed" 
>dialog with choices to abort the program or attach a debugger, when 
>running this program:
>
>#include <vector>
>
>int main()     {
>     std::vector<int>  vv;
>     vv.resize(10);
>     vv.reserve(20);
>     vv[15] = 43;
>
>}

I have no idea why VS thinks thats a reason to assert. This works fine with
gcc:

#include <iostream>
#include <vector>

using namespace std;

int main()
{
        vector<int> v;
        v.reserve(100000);
        for(int i=0;i < v.capacity();++i)
        {
                v[i] = i;
                cout << v[i] << endl;
        }
        return 0;
}

[toc] | [prev] | [next] | [standalone]


#80293

FromPaavo Helde <myfirstname@osa.pri.ee>
Date2021-06-11 14:18 +0300
Message-ID<s9vgqa$8tk$1@dont-email.me>
In reply to#80284
11.06.2021 12:24 MrSpook_0sk4i3p@b1km5k73i1.edu kirjutas:
> On Fri, 11 Jun 2021 09:23:54 +0300
> Paavo Helde <myfirstname@osa.pri.ee> wrote:
>> Mr Spook wrote: "allowing a valid [] access into the reserved but
>> uninitialised indexes".
>>
>> The operator[] is easy to check for an implementation. Indeed, VS2019 in
>> Debug mode with default options pops up a "Debug assertion failed"
>> dialog with choices to abort the program or attach a debugger, when
>> running this program:
>>
>> #include <vector>
>>
>> int main()     {
>>      std::vector<int>  vv;
>>      vv.resize(10);
>>      vv.reserve(20);
>>      vv[15] = 43;
>>
>> }
> 
> I have no idea why VS thinks thats a reason to assert. This works fine with
> gcc:
> 
> #include <iostream>
> #include <vector>
> 
> using namespace std;
> 
> int main()
> {
>          vector<int> v;
>          v.reserve(100000);
>          for(int i=0;i < v.capacity();++i)
>          {
>                  v[i] = i;
>                  cout << v[i] << endl;
>          }
>          return 0;
> }
> 

It definitely does not work fine with gcc:

 > g++ test1.cpp -D_GLIBCXX_DEBUG
 > ./a.exe
/usr/lib/gcc/x86_64-pc-cygwin/10/include/c++/debug/vector:427:
In function:
     std::__debug::vector<_Tp, _Allocator>::reference
     std::__debug::vector<_Tp,
     _Allocator>::operator[](std::__debug::vector<_Tp,
     _Allocator>::size_type) [with _Tp = int; _Allocator =
     std::allocator<int>; std::__debug::vector<_Tp, _Allocator>::reference =
     int&; std::__debug::vector<_Tp, _Allocator>::size_type = long unsigned
     int]

Error: attempt to subscript container with out-of-bounds index 0, but
container only holds 0 elements.

Objects involved in the operation:
     sequence "this" @ 0x0xffffcbf0 {
       type = std::__debug::vector<int, std::allocator<int> >;
     }
Aborted (core dumped)


Note: the -D_GLIBCXX_DEBUG flag is what you want to use to check that 
your code is correct.

[toc] | [prev] | [next] | [standalone]


#80276

FromBo Persson <bo@bo-persson.se>
Date2021-06-11 11:59 +0200
Message-ID<iigqgkF6lu4U1@mid.individual.net>
In reply to#80258
On 2021-06-11 at 11:19, MrSpook_3dnim@5ooodqy.co.uk wrote:
> On Thu, 10 Jun 2021 22:40:03 +0300
> Paavo Helde <myfirstname@osa.pri.ee> wrote:
>> 10.06.2021 18:25 MrSpook_sw@08_cl170xu11o4f8xcg45.co.uk kirjutas:
>>
>>> I always thought vector was a bit of a mess with reserve(), resize(),
>>> capacity() and size(). Having reserve() that allocates the array slots but
>>> not the objects in them so allowing a valid [] access into the reserved but
>>> uninitialised indexes which then gives indefined behaviour with non simple
>>> types is IMO something that should be flagged as Use With Extreme Caution.
>>
>> Do you realize that calling reserve() and capacity() is fully optional?
>> If you do not like them, just don't use these functions.
> 
> Thanks for the heads. My point however is that the difference is confusing
> to new devs and frankly a lot of older devs who don't use them very often.
> I don't see the point of having an allocated array with no objects in it
> anyway unless memory is really tight because what else will you do with it
> other than use the objects?
> 
>> And from where did you get the idea that accessing the vector beyond its
>> size is valid for POD types? It's definitely UB and I bet there are
> 
> If I reserve 10 integers and try and access one why would it crash? Its simply
> an area of memory defined as an integer, unlike an object that will have
> complex interactions with default or user methods that could easily cause a
> crash if you try and use any of them when uninitialised. Yes, it'll probably
> be some random value but it won't crash.
> 

If you want to access the values, you could just do resize(10) instead 
of reserve(10).

What is the problem?

[toc] | [prev] | [next] | [standalone]


#80285

FromMrSpook_jyc2xeWf9@aw55u6.gov
Date2021-06-11 10:17 +0000
Message-ID<s9vd7n$18bf$1@gioia.aioe.org>
In reply to#80276
On Fri, 11 Jun 2021 11:59:46 +0200
Bo Persson <bo@bo-persson.se> wrote:
>On 2021-06-11 at 11:19, MrSpook_3dnim@5ooodqy.co.uk wrote:
>> On Thu, 10 Jun 2021 22:40:03 +0300
>> Paavo Helde <myfirstname@osa.pri.ee> wrote:
>>> 10.06.2021 18:25 MrSpook_sw@08_cl170xu11o4f8xcg45.co.uk kirjutas:
>>>
>>>> I always thought vector was a bit of a mess with reserve(), resize(),
>>>> capacity() and size(). Having reserve() that allocates the array slots but
>>>> not the objects in them so allowing a valid [] access into the reserved but
>
>>>> uninitialised indexes which then gives indefined behaviour with non simple
>>>> types is IMO something that should be flagged as Use With Extreme Caution.
>>>
>>> Do you realize that calling reserve() and capacity() is fully optional?
>>> If you do not like them, just don't use these functions.
>> 
>> Thanks for the heads. My point however is that the difference is confusing
>> to new devs and frankly a lot of older devs who don't use them very often.
>> I don't see the point of having an allocated array with no objects in it
>> anyway unless memory is really tight because what else will you do with it
>> other than use the objects?
>> 
>>> And from where did you get the idea that accessing the vector beyond its
>>> size is valid for POD types? It's definitely UB and I bet there are
>> 
>> If I reserve 10 integers and try and access one why would it crash? Its
>simply
>> an area of memory defined as an integer, unlike an object that will have
>> complex interactions with default or user methods that could easily cause a
>> crash if you try and use any of them when uninitialised. Yes, it'll probably
>> be some random value but it won't crash.
>> 
>
>If you want to access the values, you could just do resize(10) instead 
>of reserve(10).
>
>What is the problem?

Why does it need both? What is the point of reserve() is my point.

[toc] | [prev] | [next] | [standalone]


#80283

FromMrSpook_3dnim@5ooodqy.co.uk
Date2021-06-11 09:19 +0000
Message-ID<s9v9rv$1jl9$1@gioia.aioe.org>
In reply to#80258
On Thu, 10 Jun 2021 22:40:03 +0300
Paavo Helde <myfirstname@osa.pri.ee> wrote:
>10.06.2021 18:25 MrSpook_sw@08_cl170xu11o4f8xcg45.co.uk kirjutas:
>
>> I always thought vector was a bit of a mess with reserve(), resize(),
>> capacity() and size(). Having reserve() that allocates the array slots but
>> not the objects in them so allowing a valid [] access into the reserved but
>> uninitialised indexes which then gives indefined behaviour with non simple
>> types is IMO something that should be flagged as Use With Extreme Caution.
>
>Do you realize that calling reserve() and capacity() is fully optional? 
>If you do not like them, just don't use these functions.

Thanks for the heads. My point however is that the difference is confusing
to new devs and frankly a lot of older devs who don't use them very often.
I don't see the point of having an allocated array with no objects in it
anyway unless memory is really tight because what else will you do with it
other than use the objects?

>And from where did you get the idea that accessing the vector beyond its 
>size is valid for POD types? It's definitely UB and I bet there are 

If I reserve 10 integers and try and access one why would it crash? Its simply 
an area of memory defined as an integer, unlike an object that will have 
complex interactions with default or user methods that could easily cause a 
crash if you try and use any of them when uninitialised. Yes, it'll probably
be some random value but it won't crash.

[toc] | [prev] | [next] | [standalone]


#80296

FromPaavo Helde <myfirstname@osa.pri.ee>
Date2021-06-11 14:26 +0300
Message-ID<s9vh8r$hhg$1@dont-email.me>
In reply to#80283
11.06.2021 12:19 MrSpook_3dnim@5ooodqy.co.uk kirjutas:
> On Thu, 10 Jun 2021 22:40:03 +0300
> Paavo Helde <myfirstname@osa.pri.ee> wrote:
>> 10.06.2021 18:25 MrSpook_sw@08_cl170xu11o4f8xcg45.co.uk kirjutas:
>>
>>> I always thought vector was a bit of a mess with reserve(), resize(),
>>> capacity() and size(). Having reserve() that allocates the array slots but
>>> not the objects in them so allowing a valid [] access into the reserved but
>>> uninitialised indexes which then gives indefined behaviour with non simple
>>> types is IMO something that should be flagged as Use With Extreme Caution.
>>
>> Do you realize that calling reserve() and capacity() is fully optional?
>> If you do not like them, just don't use these functions.
> 
> Thanks for the heads. My point however is that the difference is confusing
> to new devs and frankly a lot of older devs who don't use them very often.
> I don't see the point of having an allocated array with no objects in it
> anyway unless memory is really tight because what else will you do with it
> other than use the objects?
> 
>> And from where did you get the idea that accessing the vector beyond its
>> size is valid for POD types? It's definitely UB and I bet there are
> 
> If I reserve 10 integers and try and access one why would it crash? Its simply
> an area of memory defined as an integer, unlike an object that will have
> complex interactions with default or user methods that could easily cause a
> crash if you try and use any of them when uninitialised. Yes, it'll probably
> be some random value but it won't crash.

Yet another flat-earther who thinks his beliefs somehow prescribe the 
world how to behave.

Just compile your program in MSVC Debug mode or with g++ 
-D_GLIBCXX_DEBUG and witness by your own eyes it is crashing! What else 
do you want?

And this is not a fault of those compilers, the fault is in your code. 
This is why you need to change your code and not claim that the whole 
world is wrong and only your ideas are right.


[toc] | [prev] | [next] | [standalone]


#80300

FromMrSpook_35@s879vvmwpgee7rpqv.net
Date2021-06-11 11:38 +0000
Message-ID<s9vhvf$1f6d$1@gioia.aioe.org>
In reply to#80296
On Fri, 11 Jun 2021 14:26:18 +0300
Paavo Helde <myfirstname@osa.pri.ee> wrote:
>11.06.2021 12:19 MrSpook_3dnim@5ooodqy.co.uk kirjutas:
>> an area of memory defined as an integer, unlike an object that will have
>> complex interactions with default or user methods that could easily cause a
>> crash if you try and use any of them when uninitialised. Yes, it'll probably
>> be some random value but it won't crash.
>
>Yet another flat-earther who thinks his beliefs somehow prescribe the 
>world how to behave.
>
>Just compile your program in MSVC Debug mode or with g++ 
>-D_GLIBCXX_DEBUG and witness by your own eyes it is crashing! What else 
>do you want?

Thats not a crash, thats a compiler runtime warning. If it accessed OOB memory 
then the OS would segfault it.

>And this is not a fault of those compilers, the fault is in your code. 
>This is why you need to change your code and not claim that the whole 
>world is wrong and only your ideas are right.

Absolutely none of you seem to understand the what reserve() is doing.

Reserve() for vector<int> v is equivalent to:

int v[10000];

Resize() would be:

int v[10000];
bzero(v,sizeof(v));

Either way you can access the memory up to the array size except in the first
case the value is undefined.

[toc] | [prev] | [next] | [standalone]


#80306

FromPaavo Helde <myfirstname@osa.pri.ee>
Date2021-06-11 15:14 +0300
Message-ID<s9vk42$r8$1@dont-email.me>
In reply to#80300
11.06.2021 14:38 MrSpook_35@s879vvmwpgee7rpqv.net kirjutas:
> On Fri, 11 Jun 2021 14:26:18 +0300
> Paavo Helde <myfirstname@osa.pri.ee> wrote:
>> 11.06.2021 12:19 MrSpook_3dnim@5ooodqy.co.uk kirjutas:
>>> an area of memory defined as an integer, unlike an object that will have
>>> complex interactions with default or user methods that could easily cause a
>>> crash if you try and use any of them when uninitialised. Yes, it'll probably
>>> be some random value but it won't crash.
>>
>> Yet another flat-earther who thinks his beliefs somehow prescribe the
>> world how to behave.
>>
>> Just compile your program in MSVC Debug mode or with g++
>> -D_GLIBCXX_DEBUG and witness by your own eyes it is crashing! What else
>> do you want?
> 
> Thats not a crash, thats a compiler runtime warning. If it accessed OOB memory
> then the OS would segfault it.
> 

Explain that to the customer who is complaining that your program 
crashes when she compiles it with a mainstream compiler with her 
favorite settings.

[toc] | [prev] | [next] | [standalone]


#80309

FromMrSpook_uQjuVe@5szcyauh_pjzi228wvwn.info
Date2021-06-11 12:52 +0000
Message-ID<s9vm9u$1eja$1@gioia.aioe.org>
In reply to#80306
On Fri, 11 Jun 2021 15:14:57 +0300
Paavo Helde <myfirstname@osa.pri.ee> wrote:
>11.06.2021 14:38 MrSpook_35@s879vvmwpgee7rpqv.net kirjutas:
>> On Fri, 11 Jun 2021 14:26:18 +0300
>> Paavo Helde <myfirstname@osa.pri.ee> wrote:
>>> 11.06.2021 12:19 MrSpook_3dnim@5ooodqy.co.uk kirjutas:
>>>> an area of memory defined as an integer, unlike an object that will have
>>>> complex interactions with default or user methods that could easily cause a
>
>>>> crash if you try and use any of them when uninitialised. Yes, it'll
>probably
>>>> be some random value but it won't crash.
>>>
>>> Yet another flat-earther who thinks his beliefs somehow prescribe the
>>> world how to behave.
>>>
>>> Just compile your program in MSVC Debug mode or with g++
>>> -D_GLIBCXX_DEBUG and witness by your own eyes it is crashing! What else
>>> do you want?
>> 
>> Thats not a crash, thats a compiler runtime warning. If it accessed OOB
>memory
>> then the OS would segfault it.
>> 
>
>Explain that to the customer who is complaining that your program 
>crashes when she compiles it with a mainstream compiler with her 
>favorite settings.

More likely his unless you live in a parallel woke universe. I'm simply
pointing out that reserve() reserves memory that allows PODs to be used
which leads on to my point as to whats the point of it when resize() should
always be used.

[toc] | [prev] | [next] | [standalone]


#80310

FromPaavo Helde <myfirstname@osa.pri.ee>
Date2021-06-11 16:37 +0300
Message-ID<s9vov2$t3a$1@dont-email.me>
In reply to#80309
11.06.2021 15:52 MrSpook_uQjuVe@5szcyauh_pjzi228wvwn.info kirjutas:
> On Fri, 11 Jun 2021 15:14:57 +0300
> Paavo Helde <myfirstname@osa.pri.ee> wrote:
>> 11.06.2021 14:38 MrSpook_35@s879vvmwpgee7rpqv.net kirjutas:
>>> On Fri, 11 Jun 2021 14:26:18 +0300
>>> Paavo Helde <myfirstname@osa.pri.ee> wrote:
>>>> 11.06.2021 12:19 MrSpook_3dnim@5ooodqy.co.uk kirjutas:
>>>>> an area of memory defined as an integer, unlike an object that will have
>>>>> complex interactions with default or user methods that could easily cause a
>>
>>>>> crash if you try and use any of them when uninitialised. Yes, it'll
>> probably
>>>>> be some random value but it won't crash.
>>>>
>>>> Yet another flat-earther who thinks his beliefs somehow prescribe the
>>>> world how to behave.
>>>>
>>>> Just compile your program in MSVC Debug mode or with g++
>>>> -D_GLIBCXX_DEBUG and witness by your own eyes it is crashing! What else
>>>> do you want?
>>>
>>> Thats not a crash, thats a compiler runtime warning. If it accessed OOB
>> memory
>>> then the OS would segfault it.
>>>
>>
>> Explain that to the customer who is complaining that your program
>> crashes when she compiles it with a mainstream compiler with her
>> favorite settings.
> 
> More likely his unless you live in a parallel woke universe.

Obviously you missed the point why I used "her" here :-) I conclude you 
are living alone.

> I'm simply
> pointing out that reserve() reserves memory that allows PODs to be used
> which leads on to my point as to whats the point of it when resize() should
> always be used.

Reserve() is an optimization feature which can increase the speed and 
reduce the memory usage of the program when used properly. As such, it 
is not necessary to use it, as these potential performance improvements 
are modest and do not make big-O difference.

However, reserve() might also be necessary in the case when the objects 
placed in the container cannot have working copy or move constructors, 
or they are extremely expensive. If you have reserved enough memory in 
the vector, then emplace_back() et al are guaranteed to not reallocate 
the buffer, so no copy or move constructor is called.

Now one could argue that it would be almost always possible to provide a 
cheap move constructor, and therefore there is no inherent need for 
reserve(). There might be some truth in it, but the thing is that we 
didn't have move constructors before 2011, and vector::reserve() was 
there beforehand, as a way to partially compensate for this lack.

[toc] | [prev] | [next] | [standalone]


#80313

FromMrSpook_9fpRQm@i1z834r.net
Date2021-06-11 14:58 +0000
Message-ID<s9vtmp$rbk$1@gioia.aioe.org>
In reply to#80310
On Fri, 11 Jun 2021 16:37:36 +0300
Paavo Helde <myfirstname@osa.pri.ee> wrote:
>11.06.2021 15:52 MrSpook_uQjuVe@5szcyauh_pjzi228wvwn.info kirjutas:
>>> Explain that to the customer who is complaining that your program
>>> crashes when she compiles it with a mainstream compiler with her
>>> favorite settings.
>> 
>> More likely his unless you live in a parallel woke universe.
>
>Obviously you missed the point why I used "her" here :-) I conclude you 
>are living alone.

Obviously I did. And you're wrong.

>However, reserve() might also be necessary in the case when the objects 
>placed in the container cannot have working copy or move constructors, 

OK, that is a good reason for it.

[toc] | [prev] | [next] | [standalone]


#80314

FromManfred <noname@add.invalid>
Date2021-06-11 17:06 +0200
Message-ID<s9vu5d$12n7$1@gioia.aioe.org>
In reply to#80310
On 6/11/2021 3:37 PM, Paavo Helde wrote:
> 11.06.2021 15:52 MrSpook_uQjuVe@5szcyauh_pjzi228wvwn.info kirjutas:
>> On Fri, 11 Jun 2021 15:14:57 +0300
>> Paavo Helde <myfirstname@osa.pri.ee> wrote:
>>> 11.06.2021 14:38 MrSpook_35@s879vvmwpgee7rpqv.net kirjutas:
[...]
>> I'm simply
>> pointing out that reserve() reserves memory that allows PODs to be used
>> which leads on to my point as to whats the point of it when resize() 
>> should
>> always be used.
> 
> Reserve() is an optimization feature which can increase the speed and 
> reduce the memory usage of the program when used properly. As such, it 
> is not necessary to use it, as these potential performance improvements 
> are modest and do not make big-O difference.
> 
> However, reserve() might also be necessary in the case when the objects 
> placed in the container cannot have working copy or move constructors, 
> or they are extremely expensive. If you have reserved enough memory in 
> the vector, then emplace_back() et al are guaranteed to not reallocate 
> the buffer, so no copy or move constructor is called.
> 
> Now one could argue that it would be almost always possible to provide a 
> cheap move constructor, and therefore there is no inherent need for 
> reserve(). There might be some truth in it, but the thing is that we 
> didn't have move constructors before 2011, and vector::reserve() was 
> there beforehand, as a way to partially compensate for this lack.

but emplace_back was first standardized in 2011 too, which would make it 
hard to construct an object in-place before then anyway.
The argument is still valid though.

[toc] | [prev] | [standalone]


Page 13 of 13 — ← Prev page 1 … 11 12 [13]

Back to top | Article view | comp.lang.c++


csiph-web