diff options
-rw-r--r-- | include/llvm/ADT/STLExtras.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/llvm/ADT/STLExtras.h b/include/llvm/ADT/STLExtras.h index 3d2ca9eb148..abd39dacc67 100644 --- a/include/llvm/ADT/STLExtras.h +++ b/include/llvm/ADT/STLExtras.h @@ -427,6 +427,14 @@ auto count_if(R &&Range, UnaryPredicate &&P) return std::count_if(Range.begin(), Range.end(), P); } +/// Wrapper function around std::transform to apply a function to a range and +/// store the result elsewhere. +template <typename R, class OutputIt, typename UnaryPredicate> +OutputIt transform(R &&Range, OutputIt d_first, UnaryPredicate &&P) { + return std::transform(Range.begin(), Range.end(), d_first, + std::forward<UnaryPredicate>(P)); +} + //===----------------------------------------------------------------------===// // Extra additions to <memory> //===----------------------------------------------------------------------===// |