[llvm-commits] [llvm] r60587 - /llvm/trunk/include/llvm/ADT/SmallVector.h

Chris Lattner sabre at nondot.org
Thu Dec 4 23:11:06 PST 2008


Author: lattner
Date: Fri Dec  5 01:11:05 2008
New Revision: 60587

URL: http://llvm.org/viewvc/llvm-project?rev=60587&view=rev
Log:
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.

Modified:
    llvm/trunk/include/llvm/ADT/SmallVector.h

Modified: llvm/trunk/include/llvm/ADT/SmallVector.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SmallVector.h?rev=60587&r1=60586&r2=60587&view=diff

==============================================================================
--- llvm/trunk/include/llvm/ADT/SmallVector.h (original)
+++ llvm/trunk/include/llvm/ADT/SmallVector.h Fri Dec  5 01:11:05 2008
@@ -162,6 +162,12 @@
     End->~T();
   }
   
+  T pop_back_val() {
+    T Result = back();
+    pop_back();
+    return Result;
+  }
+  
   void clear() {
     destroy_range(Begin, End);
     End = Begin;





More information about the llvm-commits mailing list