[llvm] [ADT] Introduce a `static_cast_to` (PR #165803)

Jakub Kuderski via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 30 19:03:24 PDT 2025


================
@@ -1704,6 +1704,11 @@ auto sum_of(R &&Range, E Init = E{0}) {
   return accumulate(std::forward<R>(Range), std::move(Init));
 }
 
+/// Return a range where each value of `R` is static_cast to `T`
+template <typename T, typename R> auto static_cast_to(R &&Range) {
----------------
kuhar wrote:

I think the idea makes sense but I wonder if we could pick a more descriptive function name, similar to other range functions

https://github.com/llvm/llvm-project/pull/165803


More information about the llvm-commits mailing list