• Clemens Hammacher's avatar
    [base] Introduce VectorOf helper · 3ad032b7
    Clemens Hammacher authored
    We often need to create a {Vector} view of data owned by a container
    like {std::vector}. The canonical way to do this is this:
    Vector<T>{vec.data(), vec.size()}
    
    This pattern is repeating information which can be deduced
    automatically, like the type T.
    
    This CL introduces a {VectorOf} helper which can construct a {Vector}
    for any container providing a {data()} and {size()} accessor, and uses
    it to replace the pattern above.
    
    R=ishell@chromium.org
    
    Bug: v8:8238
    Change-Id: Ib3a11662acc82cb83f2b4afd07ba88e579d71dba
    Reviewed-on: https://chromium-review.googlesource.com/c/1337584Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
    Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#57538}
    3ad032b7
vector.h 8.92 KB