From: Jan Sjodin Date: Thu, 9 Mar 2017 18:25:07 +0000 (+0000) Subject: Add front() method to SetVector. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3640f26b7e13e7efe1e0674d8cec4e5dc0c903c1;p=llvm Add front() method to SetVector. Differential Revision: https://reviews.llvm.org/D27262 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297398 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/ADT/SetVector.h b/include/llvm/ADT/SetVector.h index 4dc18bc5217..220b87983ee 100644 --- a/include/llvm/ADT/SetVector.h +++ b/include/llvm/ADT/SetVector.h @@ -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!");