[PATCH] D30853: Improve the genericity of `llvm::enumerate()`.
Chandler Carruth via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 12 22:49:53 PDT 2017
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?
https://reviews.llvm.org/D30853
More information about the llvm-commits
mailing list