[PATCH] D30853: Improve the genericity of `llvm::enumerate()`.

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 12 22:52:35 PDT 2017


On Sun, Mar 12, 2017, 10:49 PM Chandler Carruth via Phabricator <
reviews at reviews.llvm.org> wrote:

> chandlerc added inline comments.
>
>
> ================
> Comment at: llvm/include/llvm/ADT/STLExtras.h:891-897
> +/// \brief Given a range of type R, iterate the entire range and return a
> +/// SmallVector with elements of the vector.  This is useful, for example,
> +/// when you want to iterate a range and then sort the results.
> +template <unsigned Size, typename R>
> +SmallVector<detail::ValueOfRange<R>, Size> to_vector(R &&Range) {
> +  return {std::begin(Range), std::end(Range)};
> +}
> ----------------
> Why not a range constructor for SmallVector?
>

Fair, I wouldn't mind that. But I did check and std::vector doesn't have
one I don't think, so I figured for consistency and that this could grow to
allow other kinds of ranges to be constructed.


>
> https://reviews.llvm.org/D30853
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170313/06c53a30/attachment.html>


More information about the llvm-commits mailing list