[llvm] r297398 - Add front() method to SetVector.
Jan Sjodin via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 9 10:25:07 PST 2017
Author: jsjodin
Date: Thu Mar 9 12:25:07 2017
New Revision: 297398
URL: http://llvm.org/viewvc/llvm-project?rev=297398&view=rev
Log:
Add front() method to SetVector.
Differential Revision: https://reviews.llvm.org/D27262
Modified:
llvm/trunk/include/llvm/ADT/SetVector.h
Modified: llvm/trunk/include/llvm/ADT/SetVector.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SetVector.h?rev=297398&r1=297397&r2=297398&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/SetVector.h (original)
+++ llvm/trunk/include/llvm/ADT/SetVector.h Thu Mar 9 12:25:07 2017
@@ -119,6 +119,12 @@ public:
return vector_.rend();
}
+ /// \brief Return the first element of the SetVector.
+ const T &front() const {
+ assert(!empty() && "Cannot call front() on empty SetVector!");
+ return vector_.front();
+ }
+
/// \brief Return the last element of the SetVector.
const T &back() const {
assert(!empty() && "Cannot call back() on empty SetVector!");
More information about the llvm-commits
mailing list