OSDN Git Service

[C++11] Remove the R-value reference #if usage from the ADT and Support
[android-x86/external-llvm.git] / include / llvm / ADT / SmallVector.h
index 505aa8d..2a5168c 100644 (file)
@@ -183,13 +183,9 @@ protected:
   /// std::move, but not all stdlibs actually provide that.
   template<typename It1, typename It2>
   static It2 move(It1 I, It1 E, It2 Dest) {
-#if LLVM_HAS_RVALUE_REFERENCES
     for (; I != E; ++I, ++Dest)
       *Dest = ::std::move(*I);
     return Dest;
-#else
-    return ::std::copy(I, E, Dest);
-#endif
   }
 
   /// move_backward - Use move-assignment to move the range
@@ -198,25 +194,17 @@ protected:
   /// std::move_backward, but not all stdlibs actually provide that.
   template<typename It1, typename It2>
   static It2 move_backward(It1 I, It1 E, It2 Dest) {
-#if LLVM_HAS_RVALUE_REFERENCES
     while (I != E)
       *--Dest = ::std::move(*--E);
     return Dest;
-#else
-    return ::std::copy_backward(I, E, Dest);
-#endif
   }
 
   /// uninitialized_move - Move the range [I, E) into the uninitialized
   /// memory starting with "Dest", constructing elements as needed.
   template<typename It1, typename It2>
   static void uninitialized_move(It1 I, It1 E, It2 Dest) {
-#if LLVM_HAS_RVALUE_REFERENCES
     for (; I != E; ++I, ++Dest)
       ::new ((void*) &*Dest) T(::std::move(*I));
-#else
-    ::std::uninitialized_copy(I, E, Dest);
-#endif
   }
 
   /// uninitialized_copy - Copy the range [I, E) onto the uninitialized
@@ -244,7 +232,6 @@ public:
     goto Retry;
   }
 
-#if LLVM_HAS_RVALUE_REFERENCES
   void push_back(T &&Elt) {
     if (this->EndX < this->CapacityX) {
     Retry:
@@ -255,8 +242,7 @@ public:
     this->grow();
     goto Retry;
   }
-#endif
-  
+
   void pop_back() {
     this->setEnd(this->end()-1);
     this->end()->~T();
@@ -428,11 +414,7 @@ public:
   }
 
   T LLVM_ATTRIBUTE_UNUSED_RESULT pop_back_val() {
-#if LLVM_HAS_RVALUE_REFERENCES
     T Result = ::std::move(this->back());
-#else
-    T Result = this->back();
-#endif
     this->pop_back();
     return Result;
   }
@@ -501,7 +483,6 @@ public:
     return(N);
   }
 
-#if LLVM_HAS_RVALUE_REFERENCES
   iterator insert(iterator I, T &&Elt) {
     if (I == this->end()) {  // Important special case for empty vector.
       this->push_back(::std::move(Elt));
@@ -532,7 +513,6 @@ public:
     I = this->begin()+EltNo;
     goto Retry;
   }
-#endif
 
   iterator insert(iterator I, const T &Elt) {
     if (I == this->end()) {  // Important special case for empty vector.
@@ -673,9 +653,7 @@ public:
 
   SmallVectorImpl &operator=(const SmallVectorImpl &RHS);
 
-#if LLVM_HAS_RVALUE_REFERENCES
   SmallVectorImpl &operator=(SmallVectorImpl &&RHS);
-#endif
 
   bool operator==(const SmallVectorImpl &RHS) const {
     if (this->size() != RHS.size()) return false;
@@ -793,7 +771,6 @@ SmallVectorImpl<T> &SmallVectorImpl<T>::
   return *this;
 }
 
-#if LLVM_HAS_RVALUE_REFERENCES
 template <typename T>
 SmallVectorImpl<T> &SmallVectorImpl<T>::operator=(SmallVectorImpl<T> &&RHS) {
   // Avoid self-assignment.
@@ -855,7 +832,6 @@ SmallVectorImpl<T> &SmallVectorImpl<T>::operator=(SmallVectorImpl<T> &&RHS) {
   RHS.clear();
   return *this;
 }
-#endif
 
 /// Storage for the SmallVector elements which aren't contained in
 /// SmallVectorTemplateCommon. There are 'N-1' elements here. The remaining '1'
@@ -904,7 +880,6 @@ public:
     return *this;
   }
 
-#if LLVM_HAS_RVALUE_REFERENCES
   SmallVector(SmallVector &&RHS) : SmallVectorImpl<T>(N) {
     if (!RHS.empty())
       SmallVectorImpl<T>::operator=(::std::move(RHS));
@@ -914,8 +889,6 @@ public:
     SmallVectorImpl<T>::operator=(::std::move(RHS));
     return *this;
   }
-#endif
-
 };
 
 template<typename T, unsigned N>