summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-08-28 21:52:08 +0000
committerChris Lattner <sabre@nondot.org>2006-08-28 21:52:08 +0000
commit86d61a5c0261ee59cc710082abc34760bd2fb9c9 (patch)
tree73548692d101d7f8f99f143b3211cce23af957cb
parent64a9e288468b3b6f2ce7cf5f361a4ac3f86d6c64 (diff)
downloadbcm5719-llvm-86d61a5c0261ee59cc710082abc34760bd2fb9c9.tar.gz
bcm5719-llvm-86d61a5c0261ee59cc710082abc34760bd2fb9c9.zip
Add 2nd form of resize
llvm-svn: 29945
-rw-r--r--llvm/include/llvm/ADT/SmallVector.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/include/llvm/ADT/SmallVector.h b/llvm/include/llvm/ADT/SmallVector.h
index ad08db33eef..d972ea6e844 100644
--- a/llvm/include/llvm/ADT/SmallVector.h
+++ b/llvm/include/llvm/ADT/SmallVector.h
@@ -124,6 +124,18 @@ public:
}
}
+ void resize(unsigned N, const T &NV) {
+ if (N < size()) {
+ destroy_range(Begin+N, End);
+ End = Begin+N;
+ } else if (N > size()) {
+ if (Begin+N > Capacity)
+ grow(N);
+ construct_range(End, Begin+N, NV);
+ End = Begin+N;
+ }
+ }
+
void swap(SmallVectorImpl &RHS);
/// append - Add the specified range to the end of the SmallVector.
OpenPOWER on IntegriCloud