src/lemon/map_iterator.h
changeset 987 87f7c54892df
parent 921 818510fa3d99
child 1164 80bb73097736
     1.1 --- a/src/lemon/map_iterator.h	Sat Nov 13 12:53:28 2004 +0000
     1.2 +++ b/src/lemon/map_iterator.h	Sat Nov 13 17:07:10 2004 +0000
     1.3 @@ -41,23 +41,23 @@
     1.4    public:
     1.5  
     1.6      /// The key type of the iterator.
     1.7 -    typedef typename Map::KeyType KeyType;
     1.8 +    typedef typename Map::Key Key;
     1.9      /// The iterator to iterate on the keys.
    1.10      typedef typename Map::KeyIt KeyIt;
    1.11  
    1.12      /// The value type of the iterator.
    1.13 -    typedef typename Map::ValueType ValueType;
    1.14 +    typedef typename Map::Value Value;
    1.15      /// The reference type of the iterator.
    1.16 -    typedef typename Map::ReferenceType ReferenceType;
    1.17 +    typedef typename Map::Reference Reference;
    1.18      /// The pointer type of the iterator.
    1.19 -    typedef typename Map::PointerType PointerType;
    1.20 +    typedef typename Map::Pointer Pointer;
    1.21  
    1.22      /// The const value type of the iterator.
    1.23 -    typedef typename Map::ConstValueType ConstValueType;
    1.24 +    typedef typename Map::ConstValue ConstValue;
    1.25      /// The const reference type of the iterator.
    1.26 -    typedef typename Map::ConstReferenceType ConstReferenceType;
    1.27 +    typedef typename Map::ConstReference ConstReference;
    1.28      /// The pointer type of the iterator.
    1.29 -    typedef typename Map::ConstPointerType ConstPointerType;
    1.30 +    typedef typename Map::ConstPointer ConstPointer;
    1.31  
    1.32    protected:
    1.33  
    1.34 @@ -104,33 +104,33 @@
    1.35      typedef MapIteratorBase<Map> Base;
    1.36  
    1.37      /// The key type of the iterator.
    1.38 -    typedef typename Map::KeyType KeyType;
    1.39 +    typedef typename Map::Key Key;
    1.40      /// The iterator to iterate on the keys.
    1.41      typedef typename Map::KeyIt KeyIt;
    1.42  
    1.43      /// The value type of the iterator.
    1.44 -    typedef typename Map::ValueType ValueType;
    1.45 +    typedef typename Map::Value Value;
    1.46      /// The reference type of the iterator.
    1.47 -    typedef typename Map::ReferenceType ReferenceType;
    1.48 +    typedef typename Map::Reference Reference;
    1.49      /// The pointer type of the iterator.
    1.50 -    typedef typename Map::PointerType PointerType;
    1.51 +    typedef typename Map::Pointer Pointer;
    1.52  
    1.53      /// The const value type of the iterator.
    1.54 -    typedef typename Map::ConstValueType ConstValueType;
    1.55 +    typedef typename Map::ConstValue ConstValue;
    1.56      /// The const reference type of the iterator.
    1.57 -    typedef typename Map::ConstReferenceType ConstReferenceType;
    1.58 +    typedef typename Map::ConstReference ConstReference;
    1.59      /// The pointer type of the iterator.
    1.60 -    typedef typename Map::ConstPointerType ConstPointerType;
    1.61 +    typedef typename Map::ConstPointer ConstPointer;
    1.62      
    1.63    public:
    1.64  
    1.65      /// The value type of the iterator.
    1.66 -    typedef extended_pair<KeyType, const KeyType&,
    1.67 -      ValueType, const ValueType&> PairValueType;
    1.68 +    typedef extended_pair<Key, const Key&,
    1.69 +      Value, const Value&> PairValue;
    1.70  
    1.71      /// The reference type of the iterator. 
    1.72 -    typedef extended_pair<const KeyType&, const KeyType&, 
    1.73 -      ReferenceType, ReferenceType> PairReferenceType;
    1.74 +    typedef extended_pair<const Key&, const Key&, 
    1.75 +      Reference, Reference> PairReference;
    1.76  
    1.77      /// Default constructor. 
    1.78      MapIterator() {}
    1.79 @@ -140,24 +140,24 @@
    1.80      MapIterator(Map& pmap, const KeyIt& pit) : Base(pit), map(&pmap) {}
    1.81  
    1.82      /// Dereference operator for the iterator.
    1.83 -    PairReferenceType operator*() {
    1.84 -      return PairReferenceType(Base::it, (*map)[Base::it]);
    1.85 +    PairReference operator*() {
    1.86 +      return PairReference(Base::it, (*map)[Base::it]);
    1.87      }
    1.88  
    1.89      /// The pointer type of the iterator.
    1.90 -    class PairPointerType {
    1.91 +    class PairPointer {
    1.92        friend class MapIterator;
    1.93      private:
    1.94 -      PairReferenceType data;
    1.95 -      PairPointerType(const KeyType& key, ReferenceType val) 
    1.96 +      PairReference data;
    1.97 +      PairPointer(const Key& key, Reference val) 
    1.98  	: data(key, val) {}
    1.99      public:
   1.100 -      PairReferenceType* operator->() {return &data;}
   1.101 +      PairReference* operator->() {return &data;}
   1.102      };
   1.103  
   1.104      /// Arrow operator for the iterator.
   1.105 -    PairPointerType operator->() {
   1.106 -      return PairPointerType(Base::it, ((*map)[Base::it])); 
   1.107 +    PairPointer operator->() {
   1.108 +      return PairPointer(Base::it, ((*map)[Base::it])); 
   1.109      }
   1.110  	
   1.111      /// The pre increment operator of the iterator.
   1.112 @@ -180,9 +180,9 @@
   1.113      // STL  compatibility typedefs.
   1.114      typedef std::forward_iterator_tag iterator_category;
   1.115      typedef int difference_type;
   1.116 -    typedef PairValueType value_type;
   1.117 -    typedef PairReferenceType reference;
   1.118 -    typedef PairPointerType pointer;
   1.119 +    typedef PairValue value_type;
   1.120 +    typedef PairReference reference;
   1.121 +    typedef PairPointer pointer;
   1.122    };
   1.123  
   1.124    /** Compatible iterator with the stl maps' iterators.
   1.125 @@ -197,23 +197,23 @@
   1.126      typedef MapIteratorBase<Map> Base;
   1.127  
   1.128      /// The key type of the iterator.
   1.129 -    typedef typename Map::KeyType KeyType;
   1.130 +    typedef typename Map::Key Key;
   1.131      /// The iterator to iterate on the keys.
   1.132      typedef typename Map::KeyIt KeyIt;
   1.133  
   1.134      /// The value type of the iterator.
   1.135 -    typedef typename Map::ValueType ValueType;
   1.136 +    typedef typename Map::Value Value;
   1.137      /// The reference type of the iterator.
   1.138 -    typedef typename Map::ReferenceType ReferenceType;
   1.139 +    typedef typename Map::Reference Reference;
   1.140      /// The pointer type of the iterator.
   1.141 -    typedef typename Map::PointerType PointerType;
   1.142 +    typedef typename Map::Pointer Pointer;
   1.143  
   1.144      /// The const value type of the iterator.
   1.145 -    typedef typename Map::ConstValueType ConstValueType;
   1.146 +    typedef typename Map::ConstValue ConstValue;
   1.147      /// The const reference type of the iterator.
   1.148 -    typedef typename Map::ConstReferenceType ConstReferenceType;
   1.149 +    typedef typename Map::ConstReference ConstReference;
   1.150      /// The pointer type of the iterator.
   1.151 -    typedef typename Map::ConstPointerType ConstPointerType;
   1.152 +    typedef typename Map::ConstPointer ConstPointer;
   1.153  
   1.154    public:    
   1.155  
   1.156 @@ -232,32 +232,32 @@
   1.157      }
   1.158  
   1.159      /// The value type of the iterator.
   1.160 -    typedef extended_pair<KeyType, const KeyType&,
   1.161 -      ValueType, const ValueType&> PairValueType;
   1.162 +    typedef extended_pair<Key, const Key&,
   1.163 +      Value, const Value&> PairValue;
   1.164  
   1.165      /// The reference type of map.
   1.166 -    typedef extended_pair<const KeyType&, const KeyType&, 
   1.167 -      ConstReferenceType, ConstReferenceType> PairReferenceType;
   1.168 +    typedef extended_pair<const Key&, const Key&, 
   1.169 +      ConstReference, ConstReference> PairReference;
   1.170  
   1.171      /// Dereference operator for the iterator.
   1.172 -    PairReferenceType operator*() {
   1.173 -      return PairReferenceType(Base::it, (*map)[Base::it]);
   1.174 +    PairReference operator*() {
   1.175 +      return PairReference(Base::it, (*map)[Base::it]);
   1.176      }
   1.177  
   1.178      /// The pointer type of the iterator.
   1.179 -    class PairPointerType {
   1.180 +    class PairPointer {
   1.181        friend class MapConstIterator;
   1.182      private:
   1.183 -      PairReferenceType data;
   1.184 -      PairPointerType(const KeyType& key, ConstReferenceType val) 
   1.185 +      PairReference data;
   1.186 +      PairPointer(const Key& key, ConstReference val) 
   1.187  	: data(key, val) {}
   1.188      public:
   1.189 -      PairReferenceType* operator->() {return &data;}
   1.190 +      PairReference* operator->() {return &data;}
   1.191      };
   1.192  
   1.193      /// Arrow operator for the iterator.
   1.194 -    PairPointerType operator->() {
   1.195 -      return PairPointerType(Base::it, (*map)[Base::it]); 
   1.196 +    PairPointer operator->() {
   1.197 +      return PairPointer(Base::it, (*map)[Base::it]); 
   1.198      }
   1.199  
   1.200      /// The pre increment operator of the iterator.
   1.201 @@ -280,9 +280,9 @@
   1.202      // STL  compatibility typedefs.
   1.203      typedef std::input_iterator_tag iterator_category;
   1.204      typedef int difference_type;
   1.205 -    typedef PairValueType value_type;
   1.206 -    typedef PairReferenceType reference;
   1.207 -    typedef PairPointerType pointer;
   1.208 +    typedef PairValue value_type;
   1.209 +    typedef PairReference reference;
   1.210 +    typedef PairPointer pointer;
   1.211    };
   1.212  
   1.213    /** The class makes the KeyIt to an stl compatible iterator
   1.214 @@ -297,7 +297,7 @@
   1.215      typedef MapIteratorBase<Map> Base;
   1.216   
   1.217      /// The key type of the iterator.
   1.218 -    typedef typename Map::KeyType KeyType;
   1.219 +    typedef typename Map::Key Key;
   1.220      /// The iterator to iterate on the keys.
   1.221      typedef typename Map::KeyIt KeyIt;
   1.222  
   1.223 @@ -323,17 +323,17 @@
   1.224      }
   1.225  
   1.226      /// The dereferencing operator of the iterator.
   1.227 -    KeyType operator*() const {
   1.228 -      return static_cast<KeyType>(Base::it);
   1.229 +    Key operator*() const {
   1.230 +      return static_cast<Key>(Base::it);
   1.231      }
   1.232  
   1.233    public:
   1.234      // STL  compatibility typedefs.
   1.235      typedef std::input_iterator_tag iterator_category;
   1.236      typedef int difference_type;
   1.237 -    typedef KeyType value_type;
   1.238 -    typedef const KeyType& reference;
   1.239 -    typedef const KeyType* pointer;
   1.240 +    typedef Key value_type;
   1.241 +    typedef const Key& reference;
   1.242 +    typedef const Key* pointer;
   1.243    };
   1.244  
   1.245    template <typename Map> class MapConstValueIterator;
   1.246 @@ -352,24 +352,24 @@
   1.247      typedef MapIteratorBase<Map> Base;
   1.248  
   1.249      /// The key type of the iterator.
   1.250 -    typedef typename Map::KeyType KeyType;
   1.251 +    typedef typename Map::Key Key;
   1.252      /// The iterator to iterate on the keys.
   1.253      typedef typename Map::KeyIt KeyIt;
   1.254  
   1.255  
   1.256      /// The value type of the iterator.
   1.257 -    typedef typename Map::ValueType ValueType;
   1.258 +    typedef typename Map::Value Value;
   1.259      /// The reference type of the iterator.
   1.260 -    typedef typename Map::ReferenceType ReferenceType;
   1.261 +    typedef typename Map::Reference Reference;
   1.262      /// The pointer type of the iterator.
   1.263 -    typedef typename Map::PointerType PointerType;
   1.264 +    typedef typename Map::Pointer Pointer;
   1.265  
   1.266      /// The const value type of the iterator.
   1.267 -    typedef typename Map::ConstValueType ConstValueType;
   1.268 +    typedef typename Map::ConstValue ConstValue;
   1.269      /// The const reference type of the iterator.
   1.270 -    typedef typename Map::ConstReferenceType ConstReferenceType;
   1.271 +    typedef typename Map::ConstReference ConstReference;
   1.272      /// The pointer type of the iterator.
   1.273 -    typedef typename Map::ConstPointerType ConstPointerType;
   1.274 +    typedef typename Map::ConstPointer ConstPointer;
   1.275  
   1.276    private:
   1.277  
   1.278 @@ -399,12 +399,12 @@
   1.279      }
   1.280  
   1.281      /// The dereferencing operator of the iterator.
   1.282 -    ReferenceType operator*() const {
   1.283 +    Reference operator*() const {
   1.284        return (*map)[Base::it];
   1.285      }
   1.286  
   1.287      /// The arrow operator of the iterator.
   1.288 -    PointerType operator->() const {
   1.289 +    Pointer operator->() const {
   1.290        return &(operator*());
   1.291      }
   1.292  
   1.293 @@ -412,9 +412,9 @@
   1.294      // STL  compatibility typedefs.
   1.295      typedef std::forward_iterator_tag iterator_category;
   1.296      typedef int difference_type;
   1.297 -    typedef ValueType value_type;
   1.298 -    typedef ReferenceType reference;
   1.299 -    typedef PointerType pointer;
   1.300 +    typedef Value value_type;
   1.301 +    typedef Reference reference;
   1.302 +    typedef Pointer pointer;
   1.303    };
   1.304  
   1.305    /** MapValueIterator creates an stl compatible iterator
   1.306 @@ -430,23 +430,23 @@
   1.307      typedef MapIteratorBase<Map> Base;
   1.308  
   1.309      /// The key type of the iterator.
   1.310 -    typedef typename Map::KeyType KeyType;
   1.311 +    typedef typename Map::Key Key;
   1.312      /// The iterator to iterate on the keys.
   1.313      typedef typename Map::KeyIt KeyIt;
   1.314  
   1.315      /// The value type of the iterator.
   1.316 -    typedef typename Map::ValueType ValueType;
   1.317 +    typedef typename Map::Value Value;
   1.318      /// The reference type of the iterator.
   1.319 -    typedef typename Map::ReferenceType ReferenceType;
   1.320 +    typedef typename Map::Reference Reference;
   1.321      /// The pointer type of the iterator.
   1.322 -    typedef typename Map::PointerType PointerType;
   1.323 +    typedef typename Map::Pointer Pointer;
   1.324  
   1.325      /// The const value type of the iterator.
   1.326 -    typedef typename Map::ConstValueType ConstValueType;
   1.327 +    typedef typename Map::ConstValue ConstValue;
   1.328      /// The const reference type of the iterator.
   1.329 -    typedef typename Map::ConstReferenceType ConstReferenceType;
   1.330 +    typedef typename Map::ConstReference ConstReference;
   1.331      /// The pointer type of the iterator.
   1.332 -    typedef typename Map::ConstPointerType ConstPointerType;
   1.333 +    typedef typename Map::ConstPointer ConstPointer;
   1.334  
   1.335    private:
   1.336  
   1.337 @@ -481,12 +481,12 @@
   1.338      }
   1.339  
   1.340      /// The dereferencing operator of the iterator.
   1.341 -    ConstReferenceType operator*() const {
   1.342 +    ConstReference operator*() const {
   1.343        return (*map)[Base::it];
   1.344      }
   1.345  
   1.346      /// The arrow operator of the iterator.
   1.347 -    ConstPointerType operator->() const {
   1.348 +    ConstPointer operator->() const {
   1.349        return &(operator*());
   1.350      }
   1.351  
   1.352 @@ -494,9 +494,9 @@
   1.353      // STL  compatibility typedefs.
   1.354      typedef std::input_iterator_tag iterator_category;
   1.355      typedef int difference_type;
   1.356 -    typedef ValueType value_type;
   1.357 -    typedef ConstReferenceType reference;
   1.358 -    typedef ConstPointerType pointer;
   1.359 +    typedef Value value_type;
   1.360 +    typedef ConstReference reference;
   1.361 +    typedef ConstPointer pointer;
   1.362    };
   1.363  
   1.364  
   1.365 @@ -511,24 +511,24 @@
   1.366    public:
   1.367  
   1.368      /// The key type of the iterator.
   1.369 -    typedef typename Map::KeyType KeyType;
   1.370 +    typedef typename Map::Key Key;
   1.371      /// The iterator to iterate on the keys.
   1.372      typedef typename Map::KeyIt KeyIt;
   1.373  
   1.374  
   1.375      /// The value type of the iterator.
   1.376 -    typedef typename Map::ValueType ValueType;
   1.377 +    typedef typename Map::Value Value;
   1.378      /// The reference type of the iterator.
   1.379 -    typedef typename Map::ReferenceType ReferenceType;
   1.380 +    typedef typename Map::Reference Reference;
   1.381      /// The pointer type of the iterator.
   1.382 -    typedef typename Map::PointerType PointerType;
   1.383 +    typedef typename Map::Pointer Pointer;
   1.384  
   1.385      /// The const value type of the iterator.
   1.386 -    typedef typename Map::ConstValueType ConstValueType;
   1.387 +    typedef typename Map::ConstValue ConstValue;
   1.388      /// The const reference type of the iterator.
   1.389 -    typedef typename Map::ConstReferenceType ConstReferenceType;
   1.390 +    typedef typename Map::ConstReference ConstReference;
   1.391      /// The pointer type of the iterator.
   1.392 -    typedef typename Map::ConstPointerType ConstPointerType;
   1.393 +    typedef typename Map::ConstPointer ConstPointer;
   1.394  
   1.395      /// The map initialized const key set.
   1.396      MapConstKeySet(const Map& pmap) : map(&pmap) {}
   1.397 @@ -548,10 +548,10 @@
   1.398   
   1.399    public:
   1.400      // STL  compatibility typedefs.
   1.401 -    typedef ValueType value_type;
   1.402 +    typedef Value value_type;
   1.403      typedef ConstIterator const_iterator;
   1.404 -    typedef ConstReferenceType const_reference;
   1.405 -    typedef ConstPointerType const_pointer;
   1.406 +    typedef ConstReference const_reference;
   1.407 +    typedef ConstPointer const_pointer;
   1.408      typedef int difference_type;
   1.409    };
   1.410  
   1.411 @@ -567,24 +567,24 @@
   1.412    public:
   1.413  
   1.414      /// The key type of the iterator.
   1.415 -    typedef typename Map::KeyType KeyType;
   1.416 +    typedef typename Map::Key Key;
   1.417      /// The iterator to iterate on the keys.
   1.418      typedef typename Map::KeyIt KeyIt;
   1.419  
   1.420  
   1.421      /// The value type of the iterator.
   1.422 -    typedef typename Map::ValueType ValueType;
   1.423 +    typedef typename Map::Value Value;
   1.424      /// The reference type of the iterator.
   1.425 -    typedef typename Map::ReferenceType ReferenceType;
   1.426 +    typedef typename Map::Reference Reference;
   1.427      /// The pointer type of the iterator.
   1.428 -    typedef typename Map::PointerType PointerType;
   1.429 +    typedef typename Map::Pointer Pointer;
   1.430  
   1.431      /// The const value type of the iterator.
   1.432 -    typedef typename Map::ConstValueType ConstValueType;
   1.433 +    typedef typename Map::ConstValue ConstValue;
   1.434      /// The const reference type of the iterator.
   1.435 -    typedef typename Map::ConstReferenceType ConstReferenceType;
   1.436 +    typedef typename Map::ConstReference ConstReference;
   1.437      /// The pointer type of the iterator.
   1.438 -    typedef typename Map::ConstPointerType ConstPointerType;
   1.439 +    typedef typename Map::ConstPointer ConstPointer;
   1.440  
   1.441      /// The map initialized const value set.
   1.442      MapConstValueSet(const Map& pmap) : map(&pmap) {}
   1.443 @@ -604,10 +604,10 @@
   1.444  
   1.445    public:
   1.446      // STL  compatibility typedefs.
   1.447 -    typedef ValueType value_type;
   1.448 +    typedef Value value_type;
   1.449      typedef ConstIterator const_iterator;
   1.450 -    typedef ConstReferenceType const_reference;
   1.451 -    typedef ConstPointerType const_pointer;
   1.452 +    typedef ConstReference const_reference;
   1.453 +    typedef ConstPointer const_pointer;
   1.454      typedef int difference_type;
   1.455    };
   1.456  
   1.457 @@ -624,24 +624,24 @@
   1.458    public:
   1.459  
   1.460      /// The key type of the iterator.
   1.461 -    typedef typename Map::KeyType KeyType;
   1.462 +    typedef typename Map::Key Key;
   1.463      /// The iterator to iterate on the keys.
   1.464      typedef typename Map::KeyIt KeyIt;
   1.465  
   1.466  
   1.467      /// The value type of the iterator.
   1.468 -    typedef typename Map::ValueType ValueType;
   1.469 +    typedef typename Map::Value Value;
   1.470      /// The reference type of the iterator.
   1.471 -    typedef typename Map::ReferenceType ReferenceType;
   1.472 +    typedef typename Map::Reference Reference;
   1.473      /// The pointer type of the iterator.
   1.474 -    typedef typename Map::PointerType PointerType;
   1.475 +    typedef typename Map::Pointer Pointer;
   1.476  
   1.477      /// The const value type of the iterator.
   1.478 -    typedef typename Map::ConstValueType ConstValueType;
   1.479 +    typedef typename Map::ConstValue ConstValue;
   1.480      /// The const reference type of the iterator.
   1.481 -    typedef typename Map::ConstReferenceType ConstReferenceType;
   1.482 +    typedef typename Map::ConstReference ConstReference;
   1.483      /// The pointer type of the iterator.
   1.484 -    typedef typename Map::ConstPointerType ConstPointerType;
   1.485 +    typedef typename Map::ConstPointer ConstPointer;
   1.486  
   1.487      /// The map initialized value set.
   1.488      MapValueSet(Map& pmap) : map(&pmap) {}
   1.489 @@ -674,13 +674,13 @@
   1.490              
   1.491    public:
   1.492      // STL  compatibility typedefs.
   1.493 -    typedef ValueType value_type;
   1.494 +    typedef Value value_type;
   1.495      typedef Iterator iterator;
   1.496      typedef ConstIterator const_iterator;
   1.497 -    typedef ReferenceType reference;
   1.498 -    typedef ConstReferenceType const_reference;
   1.499 -    typedef PointerType pointer;
   1.500 -    typedef ConstPointerType const_pointer;
   1.501 +    typedef Reference reference;
   1.502 +    typedef ConstReference const_reference;
   1.503 +    typedef Pointer pointer;
   1.504 +    typedef ConstPointer const_pointer;
   1.505      typedef int difference_type;
   1.506  
   1.507    };