add a new assign method

llvm-svn: 29562
This commit is contained in:
Chris Lattner 2006-08-08 01:44:16 +00:00
parent 97af9d5d3a
commit e2af30a922
1 changed files with 9 additions and 0 deletions

View File

@ -146,6 +146,15 @@ public:
End += NumInputs;
}
void assign(unsigned NumElts, const T &Elt) {
clear();
if (NumElts > Capacity)
grow(NumElts);
End = Begin+NumElts;
for (; NumElts; --NumElts)
new (Begin+NumElts-1) T(Elt);
}
const SmallVector &operator=(const SmallVector &RHS) {
// Avoid self-assignment.
if (this == &RHS) return *this;