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


Groups > comp.lang.c++ > #86791

Re: attempt to dereference a singular iterator

From Juha Nieminen <nospam@thanks.invalid>
Newsgroups comp.lang.c++
Subject Re: attempt to dereference a singular iterator
Date 2022-10-04 06:02 +0000
Organization Aioe.org NNTP Server
Message-ID <thgi98$174c$1@gioia.aioe.org> (permalink)
References <th1cka$4ka5$1@portraits.wsisiz.edu.pl> <thet16$hmp5$1@portraits.wsisiz.edu.pl>

Show all headers | View raw


Jivanmukta <jivanmukta@poczta.onet.pl> wrote:
> W dniu 28.09.2022 o 13:53, Jivanmukta pisze:
>> I don't understand what's wrong in my code:
>> 
>> std::vector<std::wstring> vendor_frameworks_dirs;
>> ...
>> for (auto dir = vendor_frameworks_dirs.begin(); dir != 
>> vendor_frameworks_dirs.end(); ++dir)
> 
> Changing for-loop to:
> 
> for (auto dir : vendor_frameworks_dirs)
> 
> solved the problem. I have no error.
> Problem closed.

"It doesn't complain anymore" does not necessarily mean that the problem
has been solved. It's possible that you are simply masking the problem.

You never submitted a minimal complete program so we could analyze
whether there is an actual problem or whether the debugger you are
using is just flawed. Thus, we will never know (unless someone goes
through the trouble of combing through the code you did post).

And by the way, you should use 'auto&' in that kind of loop, not 'auto'.
This especially if the elements are large (because you would be
needlessly deep-copying them). You should only use 'auto' if you
explicitly *need* to deep-copy each element into the variable for
whatever reason. (You can also use it if the elements are of an
elementary type like 'int', but even then, theres probably no
benefit.)

Back to comp.lang.c++ | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

attempt to dereference a singular iterator Jivanmukta <jivanmukta@poczta.onet.pl> - 2022-09-28 13:53 +0200
  Re: attempt to dereference a singular iterator Jivanmukta <jivanmukta@poczta.onet.pl> - 2022-09-28 14:18 +0200
    Re: attempt to dereference a singular iterator JiiPee <kerrttuPoistaTama11@gmail.com> - 2022-09-28 18:53 +0300
  Re: attempt to dereference a singular iterator Juha Nieminen <nospam@thanks.invalid> - 2022-09-28 12:19 +0000
    Re: attempt to dereference a singular iterator Jivanmukta <jivanmukta@poczta.onet.pl> - 2022-09-28 17:08 +0200
      Re: attempt to dereference a singular iterator JiiPee <kerrttuPoistaTama11@gmail.com> - 2022-09-28 18:52 +0300
        Re: attempt to dereference a singular iterator Jivanmukta <jivanmukta@poczta.onet.pl> - 2022-09-29 09:42 +0200
        Re: attempt to dereference a singular iterator Jivanmukta <jivanmukta@poczta.onet.pl> - 2022-09-29 11:58 +0200
          Re: attempt to dereference a singular iterator Juha Nieminen <nospam@thanks.invalid> - 2022-09-29 11:04 +0000
      Re: attempt to dereference a singular iterator Louis Krupp <lkrupp@invalid.pssw.com.invalid> - 2022-09-29 13:23 -0600
      Re: attempt to dereference a singular iterator Sam <sam@email-scan.com> - 2022-09-29 15:39 -0400
  Re: attempt to dereference a singular iterator Paavo Helde <eesnimi@osa.pri.ee> - 2022-09-28 19:21 +0300
    Re: attempt to dereference a singular iterator Jivanmukta <jivanmukta@poczta.onet.pl> - 2022-09-29 09:58 +0200
      Re: attempt to dereference a singular iterator Paavo Helde <eesnimi@osa.pri.ee> - 2022-09-29 15:00 +0300
        Re: attempt to dereference a singular iterator Jivanmukta <jivanmukta@poczta.onet.pl> - 2022-09-29 15:59 +0200
          Re: attempt to dereference a singular iterator Paavo Helde <eesnimi@osa.pri.ee> - 2022-09-29 17:07 +0300
            Re: attempt to dereference a singular iterator Jivanmukta <jivanmukta@poczta.onet.pl> - 2022-09-29 19:15 +0200
              Re: attempt to dereference a singular iterator Paavo Helde <eesnimi@osa.pri.ee> - 2022-09-29 22:19 +0300
                Re: attempt to dereference a singular iterator Muttley@dastardlyhq.com - 2022-09-30 13:50 +0000
                Re: attempt to dereference a singular iterator Paavo Helde <eesnimi@osa.pri.ee> - 2022-09-30 17:04 +0300
                Re: attempt to dereference a singular iterator Muttley@dastardlyhq.com - 2022-09-30 15:03 +0000
                Re: attempt to dereference a singular iterator Louis Krupp <lkrupp@invalid.pssw.com.invalid> - 2022-09-30 11:01 -0600
                Re: attempt to dereference a singular iterator Muttley@dastardlyhq.com - 2022-10-01 09:01 +0000
                Re: attempt to dereference a singular iterator scott@slp53.sl.home (Scott Lurndal) - 2022-09-30 15:19 +0000
            Re: attempt to dereference a singular iterator Juha Nieminen <nospam@thanks.invalid> - 2022-09-30 07:13 +0000
              Re: attempt to dereference a singular iterator Paavo Helde <eesnimi@osa.pri.ee> - 2022-09-30 15:56 +0300
                Re: attempt to dereference a singular iterator Jivanmukta <jivanmukta@poczta.onet.pl> - 2022-09-30 16:21 +0200
                Re: attempt to dereference a singular iterator Juha Nieminen <nospam@thanks.invalid> - 2022-09-30 16:09 +0000
          Re: attempt to dereference a singular iterator Juha Nieminen <nospam@thanks.invalid> - 2022-09-30 07:12 +0000
            Re: attempt to dereference a singular iterator Jivanmukta <jivanmukta@poczta.onet.pl> - 2022-09-30 21:05 +0200
  Re: attempt to dereference a singular iterator "Alf P. Steinbach" <alf.p.steinbach@gmail.com> - 2022-09-30 10:36 +0200
  Re: attempt to dereference a singular iterator Jivanmukta <jivanmukta@poczta.onet.pl> - 2022-10-03 16:53 +0200
    Re: attempt to dereference a singular iterator Juha Nieminen <nospam@thanks.invalid> - 2022-10-04 06:02 +0000
      Re: attempt to dereference a singular iterator Jivanmukta <jivanmukta@poczta.onet.pl> - 2022-10-05 09:42 +0200
        Re: attempt to dereference a singular iterator Juha Nieminen <nospam@thanks.invalid> - 2022-10-06 06:55 +0000
          Re: attempt to dereference a singular iterator Jivanmukta <jivanmukta@poczta.onet.pl> - 2022-10-07 07:34 +0200
            Re: attempt to dereference a singular iterator Jivanmukta <jivanmukta@poczta.onet.pl> - 2022-10-07 15:20 +0200
              Re: attempt to dereference a singular iterator Juha Nieminen <nospam@thanks.invalid> - 2022-10-10 06:21 +0000
              Re: attempt to dereference a singular iterator Öö Tiib <ootiib@hot.ee> - 2022-10-10 01:03 -0700

csiph-web