Simplify make_range by using move semantics
authorDavid Blaikie <dblaikie@gmail.com>
Thu, 10 Apr 2014 22:03:48 +0000 (22:03 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Thu, 10 Apr 2014 22:03:48 +0000 (22:03 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205993 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/ADT/iterator_range.h

index 6735700e046855dbbe5706b901dc345d8b46d7d7..dd17d6c8f7b45ca1a6a8a0d391ebdaafe224eebe 100644 (file)
@@ -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));
 }
 }