summaryrefslogtreecommitdiff
path: root/include/llvm/ADT/UniqueVector.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/ADT/UniqueVector.h')
-rw-r--r--include/llvm/ADT/UniqueVector.h15
1 files changed, 5 insertions, 10 deletions
diff --git a/include/llvm/ADT/UniqueVector.h b/include/llvm/ADT/UniqueVector.h
index e1ab4b56023f8..b17fb2392bafc 100644
--- a/include/llvm/ADT/UniqueVector.h
+++ b/include/llvm/ADT/UniqueVector.h
@@ -1,4 +1,4 @@
-//===-- llvm/ADT/UniqueVector.h ---------------------------------*- C++ -*-===//
+//===- llvm/ADT/UniqueVector.h ----------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -24,16 +24,15 @@ namespace llvm {
/// Entries can be fetched using operator[] with the entry ID.
template<class T> class UniqueVector {
public:
- typedef typename std::vector<T> VectorType;
- typedef typename VectorType::iterator iterator;
- typedef typename VectorType::const_iterator const_iterator;
+ using VectorType = typename std::vector<T>;
+ using iterator = typename VectorType::iterator;
+ using const_iterator = typename VectorType::const_iterator;
private:
// Map - Used to handle the correspondence of entry to ID.
std::map<T, unsigned> Map;
// Vector - ID ordered vector of entries. Entries can be indexed by ID - 1.
- //
VectorType Vector;
public:
@@ -68,7 +67,6 @@ public:
}
/// operator[] - Returns a reference to the entry with the specified ID.
- ///
const T &operator[](unsigned ID) const {
assert(ID-1 < size() && "ID is 0 or out of range!");
return Vector[ID - 1];
@@ -87,21 +85,18 @@ public:
const_iterator end() const { return Vector.end(); }
/// size - Returns the number of entries in the vector.
- ///
size_t size() const { return Vector.size(); }
/// empty - Returns true if the vector is empty.
- ///
bool empty() const { return Vector.empty(); }
/// reset - Clears all the entries.
- ///
void reset() {
Map.clear();
Vector.resize(0, 0);
}
};
-} // End of namespace llvm
+} // end namespace llvm
#endif // LLVM_ADT_UNIQUEVECTOR_H