diff options
author | Chris Lattner <sabre@nondot.org> | 2006-08-08 01:44:16 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-08-08 01:44:16 +0000 |
commit | 1c567b5d92c4babe33d606aa2c2643655fd3a136 (patch) | |
tree | bb6ffa6c0178f2e097e7ee65eaf9e339cf95b7ad /include | |
parent | f06f35e30b4c4d7db304f717a3d4dc6595fbd078 (diff) | |
download | external_llvm-1c567b5d92c4babe33d606aa2c2643655fd3a136.zip external_llvm-1c567b5d92c4babe33d606aa2c2643655fd3a136.tar.gz external_llvm-1c567b5d92c4babe33d606aa2c2643655fd3a136.tar.bz2 |
add a new assign method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29562 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/ADT/SmallVector.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/llvm/ADT/SmallVector.h b/include/llvm/ADT/SmallVector.h index a1d226b..0ade484 100644 --- a/include/llvm/ADT/SmallVector.h +++ b/include/llvm/ADT/SmallVector.h @@ -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; |