mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-23 16:19:52 +00:00
SmallVector's construct_range is the same thing as std::uninitialized_fill, no need to reinvent it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149851 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -299,7 +299,7 @@ public:
|
|||||||
} else if (N > this->size()) {
|
} else if (N > this->size()) {
|
||||||
if (this->capacity() < N)
|
if (this->capacity() < N)
|
||||||
this->grow(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);
|
this->setEnd(this->begin()+N);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -311,7 +311,7 @@ public:
|
|||||||
} else if (N > this->size()) {
|
} else if (N > this->size()) {
|
||||||
if (this->capacity() < N)
|
if (this->capacity() < N)
|
||||||
this->grow(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);
|
this->setEnd(this->begin()+N);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -378,7 +378,7 @@ public:
|
|||||||
if (this->capacity() < NumElts)
|
if (this->capacity() < NumElts)
|
||||||
this->grow(NumElts);
|
this->grow(NumElts);
|
||||||
this->setEnd(this->begin()+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) {
|
iterator erase(iterator I) {
|
||||||
@@ -556,12 +556,6 @@ public:
|
|||||||
assert(N <= this->capacity());
|
assert(N <= this->capacity());
|
||||||
this->setEnd(this->begin() + N);
|
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);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user