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 20 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 12 of 13 — ← Prev page 1 … 10 11 [12] 13  Next page →


#80288 — Re: Why does vector::reserve() not grow exponentially ?

FromSam <sam@email-scan.com>
Date2021-06-11 06:55 -0400
SubjectRe: Why does vector::reserve() not grow exponentially ?
Message-ID<cone.1623408933.944288.139076.1004@monster.email-scan.com>
In reply to#80248

[Multipart message — attachments visible in raw view] — view raw

Bonita Montero writes:

>> No, that would make no sense.  It is simply to allow the implementation
>> to round up the capacity a bit if that suits the memory allocator - ...
>
> There are no rounding memory-allocators. You say the allocator you
> want size = n * sizeof(type) memory and it gives you the memory and
> the allocator-API doesn't give you the opportunity to get the size
> actually allocated. So you're wrong.

Memory allocators are written by smart people. They have tons of use data  
that documents optimal allocations strategy. That data would show that even  
if you request to reserve 8388492 bytes of memory, it's better to allocate  
an even 8388608 bytes. If so, it makes perfect sense to adjust the number of  
reserved values to reflect reality.

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


#80294

FromBonita Montero <Bonita.Montero@gmail.com>
Date2021-06-11 13:19 +0200
Message-ID<s9vgs7$4ns$3@dont-email.me>
In reply to#80288
> Memory allocators are written by smart people. They have tons of use 
> data that documents optimal allocations strategy. That data would show 
> that even if you request to reserve 8388492 bytes of memory, it's better 
> to allocate an even 8388608 bytes. If so, it makes perfect sense to 
> adjust the number of reserved values to reflect reality.

That's not what we're talking about. We're talking about if
any container can notice the size actually allocated by an
allocator - it can't.
Even with the malloc()-API there's no opportunity to get the
real size of the block.

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


#80249

FromBonita Montero <Bonita.Montero@gmail.com>
Date2021-06-10 16:51 +0200
Message-ID<s9t8tb$71c$1@dont-email.me>
In reply to#80247
That's the API:
https://en.cppreference.com/w/cpp/memory/allocator/allocate
Where do you get the opportunity to get the size of the
actually logically or physically allocated memory ?

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


#80251

FromMrSpook_sw@08_cl170xu11o4f8xcg45.co.uk
Date2021-06-10 15:25 +0000
Message-ID<s9tau2$tih$1@gioia.aioe.org>
In reply to#80247
On Thu, 10 Jun 2021 16:39:13 +0200
David Brown <david.brown@hesbynett.no> wrote:
>On 10/06/2021 15:44, Bonita Montero wrote:
>>> Because reserve() is only needed for the case when the default
>>> exponential growth is not appropriate for some reason. ...
>> 
>> The standard says:
>>  "After reserve(), capacity() is _greater or equal_
>>   to the argumentof reserve if reallocation happens ..."
>> So the standard gives the vector-implementation the freedom to grow
>> beyond the size you supply with resize(). I think that's because the
>> vector has to satisfy the amortized constant inserts.
>
>No, that would make no sense.  It is simply to allow the implementation
>to round up the capacity a bit if that suits the memory allocator -
>perhaps it allocates in lumps of 4K, or cache aligned sizes, or
>something else that means when you ask for space for 19 elements it
>might give you 24 elements.

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.

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


#80252

FromBonita Montero <Bonita.Montero@gmail.com>
Date2021-06-10 18:18 +0200
Message-ID<s9te0a$e1l$1@dont-email.me>
In reply to#80251
> 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.

That's not what we're talking about. The discussion is about how much
reserve() actually allocates, not whether you can access objects behind
size() but within capacity().

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


#80258

FromPaavo Helde <myfirstname@osa.pri.ee>
Date2021-06-10 22:40 +0300
Message-ID<s9tpqk$263$1@dont-email.me>
In reply to#80251
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.

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 
debugging implementations which abort the program when they detect this 
(aborting the program is a perfect example of UB).

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


#80261

From"Alf P. Steinbach" <alf.p.steinbach@gmail.com>
Date2021-06-10 22:35 +0200
Message-ID<s9tt1r$1hs$1@dont-email.me>
In reply to#80258
On 10 Jun 2021 21:40, Paavo Helde 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.
> 
> 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 
> debugging implementations which abort the program when they detect this 
> (aborting the program is a perfect example of UB).

Depends what the guy meant.

After a `.reserve` there is a guaranteed contiguous buffer of 
`.capacity` size. With a vector size of at least 1 one can obtain a raw 
pointer to it via `data`, and index that pointer.

You'd need the legendary perverse implementation with phat pointers, to 
detect that.


- Alf

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


#80273

FromPaavo Helde <myfirstname@osa.pri.ee>
Date2021-06-11 09:23 +0300
Message-ID<s9uvhr$6q2$1@dont-email.me>
In reply to#80261
10.06.2021 23:35 Alf P. Steinbach kirjutas:
> On 10 Jun 2021 21:40, Paavo Helde 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.
>>
>> 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 debugging implementations which abort the program when they detect 
>> this (aborting the program is a perfect example of UB).
> 
> Depends what the guy meant.
> 
> After a `.reserve` there is a guaranteed contiguous buffer of 
> `.capacity` size. With a vector size of at least 1 one can obtain a raw 
> pointer to it via `data`, and index that pointer.
> 
> You'd need the legendary perverse implementation with phat pointers, to 
> detect that.

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;

}


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


#80277

FromBo Persson <bo@bo-persson.se>
Date2021-06-11 12:02 +0200
Message-ID<iigqllF6lu4U2@mid.individual.net>
In reply to#80273
On 2021-06-11 at 11:24, MrSpook_0sk4i3p@b1km5k73i1.edu wrote:
> 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;
> }
> 
> 

You mean "seems to work", which is one possible effect of UB.

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


#80278

From"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>
Date2021-06-11 03:05 -0700
Message-ID<s9vchv$ls7$1@gioia.aioe.org>
In reply to#80277
On 6/11/2021 3:02 AM, Bo Persson wrote:
> On 2021-06-11 at 11:24, MrSpook_0sk4i3p@b1km5k73i1.edu wrote:
>> 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;
>> }
>>
>>
> 
> You mean "seems to work", which is one possible effect of UB.
> 
> 

Knock on wood!

https://youtu.be/XKuJUxGntRI?list=RDGMEMQ1dJ7wXfLlqCjwV0xfSNbA

;^)

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


#80279

From"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>
Date2021-06-11 03:22 -0700
Message-ID<s9vdgm$1ce3$1@gioia.aioe.org>
In reply to#80278
On 6/11/2021 3:18 AM, MrSpook_3wcC2u9@cns8.net wrote:
> On Fri, 11 Jun 2021 03:05:52 -0700
> "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> wrote:
>> On 6/11/2021 3:02 AM, Bo Persson wrote:
>>> On 2021-06-11 at 11:24, MrSpook_0sk4i3p@b1km5k73i1.edu wrote:
>>> You mean "seems to work", which is one possible effect of UB.
>>>
>>>
>>
>> Knock on wood!
>>
>> https://youtu.be/XKuJUxGntRI?list=RDGMEMQ1dJ7wXfLlqCjwV0xfSNbA
>>
>> ;^)
> 
> Sadly not all of us have an insight into the subtext of 1970s disco tracks.
> Care to explain?
> 

If your software is infested with UB, better knock on wood!

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


#80281

From"Alf P. Steinbach" <alf.p.steinbach@gmail.com>
Date2021-06-11 12:25 +0200
Message-ID<s9vdmi$h20$1@dont-email.me>
In reply to#80278
On 11 Jun 2021 12:05, Chris M. Thomasson wrote:
> On 6/11/2021 3:02 AM, Bo Persson wrote:
>> On 2021-06-11 at 11:24, MrSpook_0sk4i3p@b1km5k73i1.edu wrote:
>>> 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;
>>> }
>>>
>>>
>>
>> You mean "seems to work", which is one possible effect of UB.
>>
>>
> 
> Knock on wood!
> 
> https://youtu.be/XKuJUxGntRI?list=RDGMEMQ1dJ7wXfLlqCjwV0xfSNbA
> 
> ;^)

My favourite song of this kind for playing on the guitar (in A with one 
note on open B string) is the Beatles' "Norwegian wood".

Then there is, of course, ZZ Top's "Woke up with wood", which makes it 
rather explicit what it's all about.

Except, I don't understand why Amii Stewart was /knocking/ on it.


- Alf (baffled)

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


#80301

FromMrSpook_4421gcxq@fceufv2.ac.uk
Date2021-06-11 11:39 +0000
Message-ID<s9vi1h$1g7m$1@gioia.aioe.org>
In reply to#80281
On Fri, 11 Jun 2021 12:25:20 +0200
"Alf P. Steinbach" <alf.p.steinbach@gmail.com> wrote:
>On 11 Jun 2021 12:05, Chris M. Thomasson wrote:
>Then there is, of course, ZZ Top's "Woke up with wood", which makes it 
>rather explicit what it's all about.
>
>Except, I don't understand why Amii Stewart was /knocking/ on it.

Knocking on wood is superstitious drivel in the english speaking world.
You do it to ward off bad luck.

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


#80287

FromMrSpook_3wcC2u9@cns8.net
Date2021-06-11 10:18 +0000
Message-ID<s9vdaf$19gp$1@gioia.aioe.org>
In reply to#80278
On Fri, 11 Jun 2021 03:05:52 -0700
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> wrote:
>On 6/11/2021 3:02 AM, Bo Persson wrote:
>> On 2021-06-11 at 11:24, MrSpook_0sk4i3p@b1km5k73i1.edu wrote:
>> You mean "seems to work", which is one possible effect of UB.
>> 
>> 
>
>Knock on wood!
>
>https://youtu.be/XKuJUxGntRI?list=RDGMEMQ1dJ7wXfLlqCjwV0xfSNbA
>
>;^)

Sadly not all of us have an insight into the subtext of 1970s disco tracks.
Care to explain?

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


#80280

From"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>
Date2021-06-11 03:27 -0700
Message-ID<s9vdqq$1hkp$1@gioia.aioe.org>
In reply to#80277
On 6/11/2021 3:17 AM, MrSpook_4bkzrb03@tu45utvus6nuc.tv wrote:
> On Fri, 11 Jun 2021 12:02:27 +0200
> Bo Persson <bo@bo-persson.se> wrote:
>> On 2021-06-11 at 11:24, MrSpook_0sk4i3p@b1km5k73i1.edu wrote:
>>> 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;
>>> }
>>>
>>>
>>
>> You mean "seems to work", which is one possible effect of UB.
> 
> Does work. There's no reason why it wouldn't unless you can think of one.
> 

size vs capacity...

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


#80286

FromMrSpook_4bkzrb03@tu45utvus6nuc.tv
Date2021-06-11 10:17 +0000
Message-ID<s9vd8m$194e$1@gioia.aioe.org>
In reply to#80277
On Fri, 11 Jun 2021 12:02:27 +0200
Bo Persson <bo@bo-persson.se> wrote:
>On 2021-06-11 at 11:24, MrSpook_0sk4i3p@b1km5k73i1.edu wrote:
>> 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;
>> }
>> 
>> 
>
>You mean "seems to work", which is one possible effect of UB.

Does work. There's no reason why it wouldn't unless you can think of one.

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


#80295

FromManfred <noname@add.invalid>
Date2021-06-11 13:22 +0200
Message-ID<s9vh1s$12ag$1@gioia.aioe.org>
In reply to#80286
On 6/11/2021 12:17 PM, MrSpook_4bkzrb03@tu45utvus6nuc.tv wrote:
> On Fri, 11 Jun 2021 12:02:27 +0200
> Bo Persson <bo@bo-persson.se> wrote:
>> On 2021-06-11 at 11:24, MrSpook_0sk4i3p@b1km5k73i1.edu wrote:
>>> 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;
>>> }
>>>
>>>
>>
>> You mean "seems to work", which is one possible effect of UB.
> 
> Does work. There's no reason why it wouldn't unless you can think of one.
> 

Memory allocated via resize() involves /construction/ of the required 
objects - i.e. invocation of their constructor via e.g. placement new.
On the contrary, reserve() allocates memory but does /not/ construct the 
objects. It is UB to access objects before their construction.

>> 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.
> 

See above.

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


#80298

FromMrSpook_0nG@p900whw6_n8r7ovwuul.ac.uk
Date2021-06-11 11:34 +0000
Message-ID<s9vho3$1bj2$1@gioia.aioe.org>
In reply to#80295
On Fri, 11 Jun 2021 13:22:37 +0200
Manfred <noname@add.invalid> wrote:
>On 6/11/2021 12:17 PM, MrSpook_4bkzrb03@tu45utvus6nuc.tv wrote:
>> Does work. There's no reason why it wouldn't unless you can think of one.
>> 
>
>Memory allocated via resize() involves /construction/ of the required 
>objects - i.e. invocation of their constructor via e.g. placement new.
>On the contrary, reserve() allocates memory but does /not/ construct the 
>objects. It is UB to access objects before their construction.

POD types do not need to be constructed. As long as the memory is addressable
thats all that matters. Why do you think I used ints as an example?

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


#80305

FromManfred <noname@add.invalid>
Date2021-06-11 14:14 +0200
Message-ID<s9vk3s$feh$1@gioia.aioe.org>
In reply to#80298
On 6/11/2021 1:34 PM, MrSpook_0nG@p900whw6_n8r7ovwuul.ac.uk wrote:
> On Fri, 11 Jun 2021 13:22:37 +0200
> Manfred <noname@add.invalid> wrote:
>> On 6/11/2021 12:17 PM, MrSpook_4bkzrb03@tu45utvus6nuc.tv wrote:
>>> Does work. There's no reason why it wouldn't unless you can think of one.
>>>
>>
>> Memory allocated via resize() involves /construction/ of the required
>> objects - i.e. invocation of their constructor via e.g. placement new.
>> On the contrary, reserve() allocates memory but does /not/ construct the
>> objects. It is UB to access objects before their construction.
> 
> POD types do not need to be constructed. As long as the memory is addressable
> thats all that matters. Why do you think I used ints as an example?
> 

You also asked why there is a need for both reserve() and resize(), 
which is another formulation of the same question.
I gave the answer and the rationale for it.

If you want to try and find an exception for a special case of some 
specifically qualified clause of some sort (and if you are willing to 
bet your job on it), go ahead and have fun diving into the 1800+ pages 
of legalese of the standard.

A word of advise: a quick look at [intro.object] shows:

1. An object is created by a definition (6.2), by a new-expression 
(7.6.2.7), by an operation that implicitly creates objects (see below), 
when implicitly changing the active member of a union (11.5), or when a 
temporary object is created (7.3.4, 6.7.7)

Now you may want to look into "implicitly created objects":
13. "[Note: Some functions in the C++ standard library implicitly create 
objects (20.10.9.2, 20.10.12, 21.5.3, 26.5.3). —end note]"

Then you are referenced a.o. to 20.10.9.2 [allocator.traits.members]
  [[nodiscard]] static constexpr pointer allocate(Alloc& a, size_type n);
  1.  Returns: a.allocate(n).

Which redirects you to Allocator::allocate; for the default allocator 
you have [allocator.members]:

   [[nodiscard]] constexpr T* allocate(size_t n);
   2 Mandates: T is not an incomplete type (6.8).
   3 Returns: A pointer to the initial element of an array of n T.
   4 Remarks: The storage for the array is obtained by calling 
::operator new (17.6.2), but it is unspecified when or how often this 
function is called. This function starts the lifetime of the array 
object, but not that of any of the array elements.

Note the last sentence: "This function starts the lifetime of the array 
object, but not that of any of the array elements"

Obviously it's perfectly possible that that's not the end of it.
Have fun!

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


#80308

FromMrSpook_p_5Ko4g@21yhpi_n4fck_wfz.org
Date2021-06-11 12:50 +0000
Message-ID<s9vm5n$1cgu$1@gioia.aioe.org>
In reply to#80305
On Fri, 11 Jun 2021 14:14:53 +0200
Manfred <noname@add.invalid> wrote:
>On 6/11/2021 1:34 PM, MrSpook_0nG@p900whw6_n8r7ovwuul.ac.uk wrote:
>> On Fri, 11 Jun 2021 13:22:37 +0200
>> Manfred <noname@add.invalid> wrote:
>>> On 6/11/2021 12:17 PM, MrSpook_4bkzrb03@tu45utvus6nuc.tv wrote:
>>>> Does work. There's no reason why it wouldn't unless you can think of one.
>>>>
>>>
>>> Memory allocated via resize() involves /construction/ of the required
>>> objects - i.e. invocation of their constructor via e.g. placement new.
>>> On the contrary, reserve() allocates memory but does /not/ construct the
>>> objects. It is UB to access objects before their construction.
>> 
>> POD types do not need to be constructed. As long as the memory is addressable
>
>> thats all that matters. Why do you think I used ints as an example?
>> 
>
>You also asked why there is a need for both reserve() and resize(), 

And I haven't had a proper answer yet. I see zero reason for reserve() existing.

>If you want to try and find an exception for a special case of some 
>specifically qualified clause of some sort (and if you are willing to 

I was making a point about reserve() allocating memory, nothing more.

>bet your job on it), go ahead and have fun diving into the 1800+ pages 
>of legalese of the standard.

I'll leave that to the aspies.

tl;dr

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


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

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


csiph-web