llvm.org GIT mirror llvm / 331861a
Merge 97974 from mainline. Iterator traits and swap. closes PR6548 and PR6549 git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_27@98312 91177308-0d34-0410-b5e6-96231b3b80d8 Tanya Lattner 10 years ago
2 changed file(s) with 23 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
189189 --NumEntries;
190190 ++NumTombstones;
191191 return true;
192 }
193
194 void swap(DenseMap& RHS) {
195 std::swap(NumBuckets, RHS.NumBuckets);
196 std::swap(Buckets, RHS.Buckets);
197 std::swap(NumEntries, RHS.NumEntries);
198 std::swap(NumTombstones, RHS.NumTombstones);
192199 }
193200
194201 value_type& FindAndConstruct(const KeyT &Key) {
4444 return TheMap.erase(V);
4545 }
4646
47 void swap(DenseSet& RHS) {
48 TheMap.swap(RHS.TheMap);
49 }
50
4751 DenseSet &operator=(const DenseSet &RHS) {
4852 TheMap = RHS.TheMap;
4953 return *this;
5458 class Iterator {
5559 typename MapTy::iterator I;
5660 public:
61 typedef typename MapTy::iterator::difference_type difference_type;
62 typedef ValueT value_type;
63 typedef value_type *pointer;
64 typedef value_type &reference;
65 typedef std::forward_iterator_tag iterator_category;
66
5767 Iterator(const typename MapTy::iterator &i) : I(i) {}
5868
5969 ValueT& operator*() { return I->first; }
6777 class ConstIterator {
6878 typename MapTy::const_iterator I;
6979 public:
80 typedef typename MapTy::const_iterator::difference_type difference_type;
81 typedef ValueT value_type;
82 typedef value_type *pointer;
83 typedef value_type &reference;
84 typedef std::forward_iterator_tag iterator_category;
85
7086 ConstIterator(const typename MapTy::const_iterator &i) : I(i) {}
7187
7288 const ValueT& operator*() { return I->first; }