add a new pop_back_val method which returns the value popped. This is
authorChris Lattner <sabre@nondot.org>
Fri, 5 Dec 2008 07:11:05 +0000 (07:11 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 5 Dec 2008 07:11:05 +0000 (07:11 +0000)
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

index 9ece43f128217a5a4cc8ac91af68871810ed51eb..94e7276150dfe47d4b6dbfcd26b6fb8b4aba2eaf 100644 (file)
@@ -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;