[llvm] r205993 - Simplify make_range by using move semantics

David Blaikie dblaikie at gmail.com
Thu Apr 10 15:03:48 PDT 2014


Author: dblaikie
Date: Thu Apr 10 17:03:48 2014
New Revision: 205993

URL: http://llvm.org/viewvc/llvm-project?rev=205993&view=rev
Log:
Simplify make_range by using move semantics

Move the iterators into the range the same way the range's ctor moves
them into the members.

Also remove some redundant top level parens in the return statement.

Modified:
    llvm/trunk/include/llvm/ADT/iterator_range.h

Modified: llvm/trunk/include/llvm/ADT/iterator_range.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/iterator_range.h?rev=205993&r1=205992&r2=205993&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/iterator_range.h (original)
+++ llvm/trunk/include/llvm/ADT/iterator_range.h Thu Apr 10 17:03:48 2014
@@ -45,8 +45,8 @@ public:
 ///
 /// This provides a bit of syntactic sugar to make using sub-ranges
 /// in for loops a bit easier. Analogous to std::make_pair().
-template<class T> iterator_range<T> make_range(const T &x, const T &y) {
-  return (iterator_range<T>(x, y));
+template <class T> iterator_range<T> make_range(T x, T y) {
+  return iterator_range<T>(std::move(x), std::move(y));
 }
 }
 





More information about the llvm-commits mailing list