[PATCH] D129781: [WIP][NFC] Introduce llvm::to_vector_of to allow creation of SmallVector<T> from range of items convertible to type T

Dawid Jurczak via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 14 08:44:40 PDT 2022


yurai007 added inline comments.


================
Comment at: llvm/include/llvm/ADT/SmallVector.h:1295
 
+template <typename Out, unsigned Size, typename R>
+SmallVector<Out, Size> to_vector_of(R &&Range) {
----------------
TODO: add more tests to make sure there is no surprises coming from overloading rules


================
Comment at: llvm/unittests/ADT/SmallVectorTest.cpp:1137
 
+TEST(SmallVectorTest, ToVector) {
+  {
----------------
That's basically copy of STLExtrasTest.ToVector test body after removing enumerate() calls. I feel it make sense to have it here since to_vector belongs to SmallVector. 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D129781/new/

https://reviews.llvm.org/D129781



More information about the llvm-commits mailing list