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

Duncan P. N. Exon Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 15 08:02:57 PDT 2022


dexonsmith added inline comments.


================
Comment at: llvm/include/llvm/ADT/SmallVector.h:1290
 template <typename R>
-SmallVector<ValueTypeFromRangeType<R>,
-            CalculateSmallVectorDefaultInlinedElements<
-                ValueTypeFromRangeType<R>>::value>
+SmallVector<ValueTypeFromRangeType<R>, InlineSize<R>::value>
 to_vector(R &&Range) {
----------------
yurai007 wrote:
> nikic wrote:
> > Why do we need to explicitly pass `InlineSize<R>::value`? Isn't that the default anyway?
> Yes, it's indeed redundant! Interesting, I didn't even bother thinking about removing it since it was present on to_vector before my change. And given that's about widely used SmallVector header I didn't expect that it could have anything superfluous.
Maybe it predates SmallVector itself having a default? Or maybe it has some hard-to-predict impact on compile time? You might be able to figure that out via a git-blame and/or a look at the original review thread, or you can ask the author that added it (if it was me, I don’t remember :)). Most likely it can just be skipped though. 


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