[llvm-branch-commits] [llvm-branch] r98312 - in /llvm/branches/release_27: ./ include/llvm/ADT/DenseMap.h include/llvm/ADT/DenseSet.h
Tanya Lattner
tonic at nondot.org
Thu Mar 11 16:10:21 PST 2010
Author: tbrethou
Date: Thu Mar 11 18:10:21 2010
New Revision: 98312
URL: http://llvm.org/viewvc/llvm-project?rev=98312&view=rev
Log:
Merge 97974 from mainline.
Iterator traits and swap. closes PR6548 and PR6549
Modified:
llvm/branches/release_27/ (props changed)
llvm/branches/release_27/include/llvm/ADT/DenseMap.h
llvm/branches/release_27/include/llvm/ADT/DenseSet.h
Propchange: llvm/branches/release_27/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Mar 11 18:10:21 2010
@@ -1 +1 @@
-/llvm/trunk:97965,98171,98193,98203,98205,98212
+/llvm/trunk:97965,97974,98171,98193,98203,98205,98212
Modified: llvm/branches/release_27/include/llvm/ADT/DenseMap.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_27/include/llvm/ADT/DenseMap.h?rev=98312&r1=98311&r2=98312&view=diff
==============================================================================
--- llvm/branches/release_27/include/llvm/ADT/DenseMap.h (original)
+++ llvm/branches/release_27/include/llvm/ADT/DenseMap.h Thu Mar 11 18:10:21 2010
@@ -192,6 +192,13 @@
return true;
}
+ void swap(DenseMap& RHS) {
+ std::swap(NumBuckets, RHS.NumBuckets);
+ std::swap(Buckets, RHS.Buckets);
+ std::swap(NumEntries, RHS.NumEntries);
+ std::swap(NumTombstones, RHS.NumTombstones);
+ }
+
value_type& FindAndConstruct(const KeyT &Key) {
BucketT *TheBucket;
if (LookupBucketFor(Key, TheBucket))
Modified: llvm/branches/release_27/include/llvm/ADT/DenseSet.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_27/include/llvm/ADT/DenseSet.h?rev=98312&r1=98311&r2=98312&view=diff
==============================================================================
--- llvm/branches/release_27/include/llvm/ADT/DenseSet.h (original)
+++ llvm/branches/release_27/include/llvm/ADT/DenseSet.h Thu Mar 11 18:10:21 2010
@@ -45,6 +45,10 @@
return TheMap.erase(V);
}
+ void swap(DenseSet& RHS) {
+ TheMap.swap(RHS.TheMap);
+ }
+
DenseSet &operator=(const DenseSet &RHS) {
TheMap = RHS.TheMap;
return *this;
@@ -55,6 +59,12 @@
class Iterator {
typename MapTy::iterator I;
public:
+ typedef typename MapTy::iterator::difference_type difference_type;
+ typedef ValueT value_type;
+ typedef value_type *pointer;
+ typedef value_type &reference;
+ typedef std::forward_iterator_tag iterator_category;
+
Iterator(const typename MapTy::iterator &i) : I(i) {}
ValueT& operator*() { return I->first; }
@@ -68,6 +78,12 @@
class ConstIterator {
typename MapTy::const_iterator I;
public:
+ typedef typename MapTy::const_iterator::difference_type difference_type;
+ typedef ValueT value_type;
+ typedef value_type *pointer;
+ typedef value_type &reference;
+ typedef std::forward_iterator_tag iterator_category;
+
ConstIterator(const typename MapTy::const_iterator &i) : I(i) {}
const ValueT& operator*() { return I->first; }
More information about the llvm-branch-commits
mailing list