No need to check condition after grow()

r206916 was not logically the same as the previous code because the
goto statements did not create loop. This should be the same as the
previous code.

llvm-svn: 206918
This commit is contained in:
Rui Ueyama 2014-04-22 19:47:26 +00:00
parent 3e993d0f42
commit 17a9a84f5c
1 changed files with 5 additions and 5 deletions

View File

@ -223,14 +223,14 @@ protected:
public:
void push_back(const T &Elt) {
while (this->EndX >= this->CapacityX)
if (this->EndX >= this->CapacityX)
this->grow();
::new ((void*) this->end()) T(Elt);
this->setEnd(this->end()+1);
}
void push_back(T &&Elt) {
while (this->EndX >= this->CapacityX)
if (this->EndX >= this->CapacityX)
this->grow();
::new ((void*) this->end()) T(::std::move(Elt));
this->setEnd(this->end()+1);
@ -327,7 +327,7 @@ protected:
}
public:
void push_back(const T &Elt) {
while (this->EndX >= this->CapacityX)
if (this->EndX >= this->CapacityX)
this->grow();
memcpy(this->end(), &Elt, sizeof(T));
this->setEnd(this->end()+1);
@ -481,7 +481,7 @@ public:
assert(I >= this->begin() && "Insertion iterator is out of bounds.");
assert(I <= this->end() && "Inserting past the end of the vector.");
while (this->EndX >= this->CapacityX) {
if (this->EndX >= this->CapacityX) {
size_t EltNo = I-this->begin();
this->grow();
I = this->begin()+EltNo;
@ -511,7 +511,7 @@ public:
assert(I >= this->begin() && "Insertion iterator is out of bounds.");
assert(I <= this->end() && "Inserting past the end of the vector.");
while (this->EndX >= this->CapacityX) {
if (this->EndX >= this->CapacityX) {
size_t EltNo = I-this->begin();
this->grow();
I = this->begin()+EltNo;