1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00

[ADT] Add a range variant of std::transform

This will be used in a followup change in clang.

llvm-svn: 273520
This commit is contained in:
David Majnemer 2016-06-23 00:14:26 +00:00
parent 8753e3d95a
commit bed83762f6

View File

@ -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>
//===----------------------------------------------------------------------===//