summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorReid Kleckner <reid@kleckner.net>2013-05-22 17:10:11 +0000
committerReid Kleckner <reid@kleckner.net>2013-05-22 17:10:11 +0000
commit1fc96a323e3c7101791955347fe5fcd83c76f92a (patch)
tree4e64f11295a3209cf0db4e9f6177a7b23bf8989b /llvm
parentd76cc186fcc823f37ae6f4e1785dab42602d2839 (diff)
downloadbcm5719-llvm-1fc96a323e3c7101791955347fe5fcd83c76f92a.tar.gz
bcm5719-llvm-1fc96a323e3c7101791955347fe5fcd83c76f92a.zip
[Support] Add StringMap::swap() and a default ctor for iterators
This makes StringMap<> more compatible with std::map<std::string, ...>. Differential Revision: http://llvm-reviews.chandlerc.com/D842 llvm-svn: 182487
Diffstat (limited to 'llvm')
-rw-r--r--llvm/include/llvm/ADT/StringMap.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/include/llvm/ADT/StringMap.h b/llvm/include/llvm/ADT/StringMap.h
index d01437b61c2..2e07268596a 100644
--- a/llvm/include/llvm/ADT/StringMap.h
+++ b/llvm/include/llvm/ADT/StringMap.h
@@ -102,6 +102,13 @@ public:
bool empty() const { return NumItems == 0; }
unsigned size() const { return NumItems; }
+
+ void swap(StringMapImpl &Other) {
+ std::swap(TheTable, Other.TheTable);
+ std::swap(NumBuckets, Other.NumBuckets);
+ std::swap(NumItems, Other.NumItems);
+ std::swap(NumTombstones, Other.NumTombstones);
+ }
};
/// StringMapEntry - This is used to represent one value that is inserted into
@@ -409,6 +416,8 @@ protected:
public:
typedef StringMapEntry<ValueTy> value_type;
+ StringMapConstIterator() : Ptr(0) { }
+
explicit StringMapConstIterator(StringMapEntryBase **Bucket,
bool NoAdvance = false)
: Ptr(Bucket) {
@@ -448,6 +457,7 @@ private:
template<typename ValueTy>
class StringMapIterator : public StringMapConstIterator<ValueTy> {
public:
+ StringMapIterator() : StringMapConstIterator() {}
explicit StringMapIterator(StringMapEntryBase **Bucket,
bool NoAdvance = false)
: StringMapConstIterator<ValueTy>(Bucket, NoAdvance) {
OpenPOWER on IntegriCloud