From: Chris Lattner Date: Fri, 5 Dec 2008 07:11:05 +0000 (+0000) Subject: add a new pop_back_val method which returns the value popped. This is X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=7f50863e527f5464bd6fcbcd7719f8344f54cb7e;p=oota-llvm.git add a new pop_back_val method which returns the value popped. This is heretical from a STL standpoint, but is oh-so-useful for things that can't throw exceptions when copied, like, well, everything in LLVM. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60587 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/ADT/SmallVector.h b/include/llvm/ADT/SmallVector.h index 9ece43f1282..94e7276150d 100644 --- a/include/llvm/ADT/SmallVector.h +++ b/include/llvm/ADT/SmallVector.h @@ -162,6 +162,12 @@ public: End->~T(); } + T pop_back_val() { + T Result = back(); + pop_back(); + return Result; + } + void clear() { destroy_range(Begin, End); End = Begin;