From 7f50863e527f5464bd6fcbcd7719f8344f54cb7e Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 5 Dec 2008 07:11:05 +0000 Subject: [PATCH] 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 --- include/llvm/ADT/SmallVector.h | 6 ++++++ 1 file changed, 6 insertions(+) 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; -- 2.34.1