aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/ADT/UniqueVector.h
diff options
context:
space:
mode:
authorMisha Brukman <brukman+llvm@gmail.com>2009-01-09 19:25:42 +0000
committerMisha Brukman <brukman+llvm@gmail.com>2009-01-09 19:25:42 +0000
commit3a54b3dc87a581c203b18050b4f787b4ca28a12c (patch)
treec7cd9d64b35ff34786c12499439ef5e525642d50 /include/llvm/ADT/UniqueVector.h
parent6e7a1617ac4a34792d9097b8d3644b72f57a45f7 (diff)
Removed trailing whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62000 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/ADT/UniqueVector.h')
-rw-r--r--include/llvm/ADT/UniqueVector.h20
1 files changed, 10 insertions, 10 deletions
diff --git a/include/llvm/ADT/UniqueVector.h b/include/llvm/ADT/UniqueVector.h
index b114b8231e..2d02d1ce16 100644
--- a/include/llvm/ADT/UniqueVector.h
+++ b/include/llvm/ADT/UniqueVector.h
@@ -20,7 +20,7 @@ namespace llvm {
/// UniqueVector - This class produces a sequential ID number (base 1) for each
/// unique entry that is added. T is the type of entries in the vector. This
/// class should have an implementation of operator== and of operator<.
-/// Entries can be fetched using operator[] with the entry ID.
+/// Entries can be fetched using operator[] with the entry ID.
template<class T> class UniqueVector {
private:
// Map - Used to handle the correspondence of entry to ID.
@@ -29,34 +29,34 @@ private:
// Vector - ID ordered vector of entries. Entries can be indexed by ID - 1.
//
std::vector<T> Vector;
-
+
public:
/// insert - Append entry to the vector if it doesn't already exist. Returns
/// the entry's index + 1 to be used as a unique ID.
unsigned insert(const T &Entry) {
// Check if the entry is already in the map.
unsigned &Val = Map[Entry];
-
+
// See if entry exists, if so return prior ID.
if (Val) return Val;
// Compute ID for entry.
Val = static_cast<unsigned>(Vector.size()) + 1;
-
+
// Insert in vector.
Vector.push_back(Entry);
return Val;
}
-
+
/// idFor - return the ID for an existing entry. Returns 0 if the entry is
/// not found.
unsigned idFor(const T &Entry) const {
// Search for entry in the map.
typename std::map<T, unsigned>::const_iterator MI = Map.find(Entry);
-
+
// See if entry exists, if so return ID.
if (MI != Map.end()) return MI->second;
-
+
// No luck.
return 0;
}
@@ -67,15 +67,15 @@ public:
assert(ID-1 < size() && "ID is 0 or out of range!");
return Vector[ID - 1];
}
-
+
/// 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() {