From 7867935f717d2ca150197c7193cafb88a41bdf4c Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Thu, 23 Jun 2016 00:14:26 +0000 Subject: [ADT] Add a range variant of std::transform This will be used in a followup change in clang. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273520 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/ADT/STLExtras.h | 8 ++++++++ 1 file changed, 8 insertions(+) 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 +OutputIt transform(R &&Range, OutputIt d_first, UnaryPredicate &&P) { + return std::transform(Range.begin(), Range.end(), d_first, + std::forward(P)); +} + //===----------------------------------------------------------------------===// // Extra additions to //===----------------------------------------------------------------------===// -- cgit v1.2.3