aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/llvm/ADT/SmallVector.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/llvm/ADT/SmallVector.h b/include/llvm/ADT/SmallVector.h
index a1d226be07..0ade4847b4 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;