[PATCH] D83902: [ADT] Add a range-based version of std::move

Nathan James via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 15 13:21:28 PDT 2020


njames93 created this revision.
njames93 added reviewers: dblaikie, bkramer.
Herald added subscribers: llvm-commits, dexonsmith.
Herald added a project: LLVM.

Adds a range-based version of `std::move`, the version that moves a range, not the one that creates r-value references.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D83902

Files:
  llvm/include/llvm/ADT/STLExtras.h


Index: llvm/include/llvm/ADT/STLExtras.h
===================================================================
--- llvm/include/llvm/ADT/STLExtras.h
+++ llvm/include/llvm/ADT/STLExtras.h
@@ -1543,6 +1543,13 @@
   return std::copy(adl_begin(Range), adl_end(Range), Out);
 }
 
+/// Provide wrappers to std::move which take ranges instead of having to
+/// pass begin/end explicitly.
+template <typename R, typename OutputIt>
+OutputIt move(R &&Range, OutputIt Out) {
+  return std::move(adl_begin(Range), adl_end(Range), Out);
+}
+
 /// Wrapper function around std::find to detect if an element exists
 /// in a container.
 template <typename R, typename E>


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83902.278293.patch
Type: text/x-patch
Size: 654 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200715/0f250df9/attachment.bin>


More information about the llvm-commits mailing list