[PATCH] D131289: [ADT] Add is_splat overload accepting initializer_list

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 5 16:09:01 PDT 2022


dblaikie added inline comments.


================
Comment at: llvm/include/llvm/ADT/STLExtras.h:1801
+template <typename T> bool is_splat(std::initializer_list<T> Values) {
+  return is_splat(make_range(Values.begin(), Values.end()));
+}
----------------
hmm, `Values` is already a valid range, so it's a bit awkward/unfortunate to make a new range from it.

could we make this add the template parameter explicitly?
```
return is_splat<std::initializer_list<T>>(std::move(Values));
```
(the move doesn't do much (since `std::initializer_list` is immutable, yeah?), but I think it's that or you have to make the parameter a reference type, to work with the universal reference stuff?)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131289



More information about the llvm-commits mailing list