[Webkit-unassigned] [Bug 127506] New: Avoid unnecessary copies in range-based for-loops

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Jan 23 12:49:20 PST 2014


https://bugs.webkit.org/show_bug.cgi?id=127506

           Summary: Avoid unnecessary copies in range-based for-loops
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: Unspecified
        OS/Version: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: New Bugs
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: zandobersek at gmail.com
                CC: andersca at apple.com


In around 20 files range-based for-loops are used that assign each iterated value to an inferred non-reference type, causing copies:

    for (auto elem : range) { ... }

auto& or const auto& should be used instead.

Using auto&& in these loops would be the perfect solution, and there are plans to further simplify the range-based for-loops in the future based on using that type. I don't know if using auto&& now would be feasible for the project.
http://open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3853.htm

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list