octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #63738] Changing iterators to range-based loop


From: Arun Giridhar
Subject: [Octave-bug-tracker] [bug #63738] Changing iterators to range-based loops where possible
Date: Wed, 1 Feb 2023 17:44:25 -0500 (EST)

URL:
  <https://savannah.gnu.org/bugs/?63738>

                 Summary: Changing iterators to range-based loops where
possible
                 Project: GNU Octave
               Submitter: arungiridhar
               Submitted: Wed 01 Feb 2023 05:44:23 PM EST
                Category: Coding Style and Maintenance
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Other
                  Status: Patch Submitted
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
                 Release: dev
         Discussion Lock: Any
        Operating System: Any
           Fixed Release: None
         Planned Release: 9.1.0 (current default)


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Wed 01 Feb 2023 05:44:23 PM EST By: Arun Giridhar <arungiridhar>
There are some 40+ instances in the codebase of this pattern:

  for (auto it = rows.begin (); it != rows.end (); it++)
    do_something_with (*it);


Are there any objections to replacing them where possible with this shorter
version?

  for (auto& it : rows)
    do_something_with (it);


An example patch is attached for a few files.

Please also comment on preference for auto&, auto&&, const auto& etc.






    _______________________________________________________
File Attachments:


-------------------------------------------------------
Date: Wed 01 Feb 2023 05:44:23 PM EST  Name: auto.patch  Size: 5KiB   By:
arungiridhar

<http://savannah.gnu.org/bugs/download.php?file_id=54295>

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?63738>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]