From f699e1cb435aaf6379d06c9f37b5efc183e6d0e7 Mon Sep 17 00:00:00 2001 From: Jan Sjodin Date: Thu, 9 Mar 2017 18:25:07 +0000 Subject: [PATCH] Add front() method to SetVector. Differential Revision: https://reviews.llvm.org/D27262 llvm-svn: 297398 --- include/llvm/ADT/SetVector.h | 6 ++++++ 1 file changed, 6 insertions(+) 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!");