[llvm-commits] [llvm] r149851 - /llvm/trunk/include/llvm/ADT/SmallVector.h
Benjamin Kramer
benny.kra at googlemail.com
Sun Feb 5 14:48:31 PST 2012
Author: d0k
Date: Sun Feb 5 16:48:31 2012
New Revision: 149851
URL: http://llvm.org/viewvc/llvm-project?rev=149851&view=rev
Log:
SmallVector's construct_range is the same thing as std::uninitialized_fill, no need to reinvent it.
Modified:
llvm/trunk/include/llvm/ADT/SmallVector.h
Modified: llvm/trunk/include/llvm/ADT/SmallVector.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SmallVector.h?rev=149851&r1=149850&r2=149851&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/SmallVector.h (original)
+++ llvm/trunk/include/llvm/ADT/SmallVector.h Sun Feb 5 16:48:31 2012
@@ -299,7 +299,7 @@
} else if (N > this->size()) {
if (this->capacity() < N)
this->grow(N);
- this->construct_range(this->end(), this->begin()+N, T());
+ std::uninitialized_fill(this->end(), this->begin()+N, T());
this->setEnd(this->begin()+N);
}
}
@@ -311,7 +311,7 @@
} else if (N > this->size()) {
if (this->capacity() < N)
this->grow(N);
- construct_range(this->end(), this->begin()+N, NV);
+ std::uninitialized_fill(this->end(), this->begin()+N, NV);
this->setEnd(this->begin()+N);
}
}
@@ -378,7 +378,7 @@
if (this->capacity() < NumElts)
this->grow(NumElts);
this->setEnd(this->begin()+NumElts);
- construct_range(this->begin(), this->end(), Elt);
+ std::uninitialized_fill(this->begin(), this->end(), Elt);
}
iterator erase(iterator I) {
@@ -556,12 +556,6 @@
assert(N <= this->capacity());
this->setEnd(this->begin() + N);
}
-
-private:
- static void construct_range(T *S, T *E, const T &Elt) {
- for (; S != E; ++S)
- new (S) T(Elt);
- }
};
More information about the llvm-commits
mailing list