• Jan Wilken Dörrie's avatar
    [base] Ranges: Improve begin() and end() · 9cf92ca4
    Jan Wilken Dörrie authored
    This change improves util::ranges::begin() and end() by adding constexpr
    support and making them prefer a member function over a free standing
    function. This serves to close the gap to std::ranges::begin() and
    std::ranges::end() as specified by the C++20 standard.
    
    Furthermore, special constexpr support is added for std::array, which
    otherwise only has constexpr support in C++17.
    
    Lastly, it moves the functions from the iterator.h to the ranges.h
    header, since in C++20 these functions are present in <ranges>, not
    <iterator>.
    
    Bug: 1071094
    Change-Id: Id5f3b7ff83b3fb336286f4ed2d4fe8a6cfcf0b9c
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2325171Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
    Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#793034}
    9cf92ca4
ranges_unittest.cc 2.79 KB