src/lemon/map_iterator.h
changeset 1127 2dea256cb988
parent 921 818510fa3d99
child 1164 80bb73097736
equal deleted inserted replaced
0:7a25e1bdb3e2 1:e3aea4bf511d
    39   class MapIteratorBase {
    39   class MapIteratorBase {
    40 
    40 
    41   public:
    41   public:
    42 
    42 
    43     /// The key type of the iterator.
    43     /// The key type of the iterator.
    44     typedef typename Map::KeyType KeyType;
    44     typedef typename Map::Key Key;
    45     /// The iterator to iterate on the keys.
    45     /// The iterator to iterate on the keys.
    46     typedef typename Map::KeyIt KeyIt;
    46     typedef typename Map::KeyIt KeyIt;
    47 
    47 
    48     /// The value type of the iterator.
    48     /// The value type of the iterator.
    49     typedef typename Map::ValueType ValueType;
    49     typedef typename Map::Value Value;
    50     /// The reference type of the iterator.
    50     /// The reference type of the iterator.
    51     typedef typename Map::ReferenceType ReferenceType;
    51     typedef typename Map::Reference Reference;
    52     /// The pointer type of the iterator.
    52     /// The pointer type of the iterator.
    53     typedef typename Map::PointerType PointerType;
    53     typedef typename Map::Pointer Pointer;
    54 
    54 
    55     /// The const value type of the iterator.
    55     /// The const value type of the iterator.
    56     typedef typename Map::ConstValueType ConstValueType;
    56     typedef typename Map::ConstValue ConstValue;
    57     /// The const reference type of the iterator.
    57     /// The const reference type of the iterator.
    58     typedef typename Map::ConstReferenceType ConstReferenceType;
    58     typedef typename Map::ConstReference ConstReference;
    59     /// The pointer type of the iterator.
    59     /// The pointer type of the iterator.
    60     typedef typename Map::ConstPointerType ConstPointerType;
    60     typedef typename Map::ConstPointer ConstPointer;
    61 
    61 
    62   protected:
    62   protected:
    63 
    63 
    64     KeyIt it;
    64     KeyIt it;
    65 
    65 
   102 
   102 
   103     /// The iterator base class.
   103     /// The iterator base class.
   104     typedef MapIteratorBase<Map> Base;
   104     typedef MapIteratorBase<Map> Base;
   105 
   105 
   106     /// The key type of the iterator.
   106     /// The key type of the iterator.
   107     typedef typename Map::KeyType KeyType;
   107     typedef typename Map::Key Key;
   108     /// The iterator to iterate on the keys.
   108     /// The iterator to iterate on the keys.
   109     typedef typename Map::KeyIt KeyIt;
   109     typedef typename Map::KeyIt KeyIt;
   110 
   110 
   111     /// The value type of the iterator.
   111     /// The value type of the iterator.
   112     typedef typename Map::ValueType ValueType;
   112     typedef typename Map::Value Value;
   113     /// The reference type of the iterator.
   113     /// The reference type of the iterator.
   114     typedef typename Map::ReferenceType ReferenceType;
   114     typedef typename Map::Reference Reference;
   115     /// The pointer type of the iterator.
   115     /// The pointer type of the iterator.
   116     typedef typename Map::PointerType PointerType;
   116     typedef typename Map::Pointer Pointer;
   117 
   117 
   118     /// The const value type of the iterator.
   118     /// The const value type of the iterator.
   119     typedef typename Map::ConstValueType ConstValueType;
   119     typedef typename Map::ConstValue ConstValue;
   120     /// The const reference type of the iterator.
   120     /// The const reference type of the iterator.
   121     typedef typename Map::ConstReferenceType ConstReferenceType;
   121     typedef typename Map::ConstReference ConstReference;
   122     /// The pointer type of the iterator.
   122     /// The pointer type of the iterator.
   123     typedef typename Map::ConstPointerType ConstPointerType;
   123     typedef typename Map::ConstPointer ConstPointer;
   124     
   124     
   125   public:
   125   public:
   126 
   126 
   127     /// The value type of the iterator.
   127     /// The value type of the iterator.
   128     typedef extended_pair<KeyType, const KeyType&,
   128     typedef extended_pair<Key, const Key&,
   129       ValueType, const ValueType&> PairValueType;
   129       Value, const Value&> PairValue;
   130 
   130 
   131     /// The reference type of the iterator. 
   131     /// The reference type of the iterator. 
   132     typedef extended_pair<const KeyType&, const KeyType&, 
   132     typedef extended_pair<const Key&, const Key&, 
   133       ReferenceType, ReferenceType> PairReferenceType;
   133       Reference, Reference> PairReference;
   134 
   134 
   135     /// Default constructor. 
   135     /// Default constructor. 
   136     MapIterator() {}
   136     MapIterator() {}
   137 
   137 
   138     /// Constructor to initalize the iterators returned 
   138     /// Constructor to initalize the iterators returned 
   139     /// by the begin() and end().
   139     /// by the begin() and end().
   140     MapIterator(Map& pmap, const KeyIt& pit) : Base(pit), map(&pmap) {}
   140     MapIterator(Map& pmap, const KeyIt& pit) : Base(pit), map(&pmap) {}
   141 
   141 
   142     /// Dereference operator for the iterator.
   142     /// Dereference operator for the iterator.
   143     PairReferenceType operator*() {
   143     PairReference operator*() {
   144       return PairReferenceType(Base::it, (*map)[Base::it]);
   144       return PairReference(Base::it, (*map)[Base::it]);
   145     }
   145     }
   146 
   146 
   147     /// The pointer type of the iterator.
   147     /// The pointer type of the iterator.
   148     class PairPointerType {
   148     class PairPointer {
   149       friend class MapIterator;
   149       friend class MapIterator;
   150     private:
   150     private:
   151       PairReferenceType data;
   151       PairReference data;
   152       PairPointerType(const KeyType& key, ReferenceType val) 
   152       PairPointer(const Key& key, Reference val) 
   153 	: data(key, val) {}
   153 	: data(key, val) {}
   154     public:
   154     public:
   155       PairReferenceType* operator->() {return &data;}
   155       PairReference* operator->() {return &data;}
   156     };
   156     };
   157 
   157 
   158     /// Arrow operator for the iterator.
   158     /// Arrow operator for the iterator.
   159     PairPointerType operator->() {
   159     PairPointer operator->() {
   160       return PairPointerType(Base::it, ((*map)[Base::it])); 
   160       return PairPointer(Base::it, ((*map)[Base::it])); 
   161     }
   161     }
   162 	
   162 	
   163     /// The pre increment operator of the iterator.
   163     /// The pre increment operator of the iterator.
   164     MapIterator& operator++() { 
   164     MapIterator& operator++() { 
   165       Base::increment(); 
   165       Base::increment(); 
   178 
   178 
   179   public:
   179   public:
   180     // STL  compatibility typedefs.
   180     // STL  compatibility typedefs.
   181     typedef std::forward_iterator_tag iterator_category;
   181     typedef std::forward_iterator_tag iterator_category;
   182     typedef int difference_type;
   182     typedef int difference_type;
   183     typedef PairValueType value_type;
   183     typedef PairValue value_type;
   184     typedef PairReferenceType reference;
   184     typedef PairReference reference;
   185     typedef PairPointerType pointer;
   185     typedef PairPointer pointer;
   186   };
   186   };
   187 
   187 
   188   /** Compatible iterator with the stl maps' iterators.
   188   /** Compatible iterator with the stl maps' iterators.
   189    *  It iterates on pairs of a key and a value.
   189    *  It iterates on pairs of a key and a value.
   190    */
   190    */
   195 
   195 
   196     /// The iterator base class.
   196     /// The iterator base class.
   197     typedef MapIteratorBase<Map> Base;
   197     typedef MapIteratorBase<Map> Base;
   198 
   198 
   199     /// The key type of the iterator.
   199     /// The key type of the iterator.
   200     typedef typename Map::KeyType KeyType;
   200     typedef typename Map::Key Key;
   201     /// The iterator to iterate on the keys.
   201     /// The iterator to iterate on the keys.
   202     typedef typename Map::KeyIt KeyIt;
   202     typedef typename Map::KeyIt KeyIt;
   203 
   203 
   204     /// The value type of the iterator.
   204     /// The value type of the iterator.
   205     typedef typename Map::ValueType ValueType;
   205     typedef typename Map::Value Value;
   206     /// The reference type of the iterator.
   206     /// The reference type of the iterator.
   207     typedef typename Map::ReferenceType ReferenceType;
   207     typedef typename Map::Reference Reference;
   208     /// The pointer type of the iterator.
   208     /// The pointer type of the iterator.
   209     typedef typename Map::PointerType PointerType;
   209     typedef typename Map::Pointer Pointer;
   210 
   210 
   211     /// The const value type of the iterator.
   211     /// The const value type of the iterator.
   212     typedef typename Map::ConstValueType ConstValueType;
   212     typedef typename Map::ConstValue ConstValue;
   213     /// The const reference type of the iterator.
   213     /// The const reference type of the iterator.
   214     typedef typename Map::ConstReferenceType ConstReferenceType;
   214     typedef typename Map::ConstReference ConstReference;
   215     /// The pointer type of the iterator.
   215     /// The pointer type of the iterator.
   216     typedef typename Map::ConstPointerType ConstPointerType;
   216     typedef typename Map::ConstPointer ConstPointer;
   217 
   217 
   218   public:    
   218   public:    
   219 
   219 
   220     /// Default constructor. 
   220     /// Default constructor. 
   221     MapConstIterator() {}
   221     MapConstIterator() {}
   230       Base::it = pit.Base::it;
   230       Base::it = pit.Base::it;
   231       map = pit.map;
   231       map = pit.map;
   232     }
   232     }
   233 
   233 
   234     /// The value type of the iterator.
   234     /// The value type of the iterator.
   235     typedef extended_pair<KeyType, const KeyType&,
   235     typedef extended_pair<Key, const Key&,
   236       ValueType, const ValueType&> PairValueType;
   236       Value, const Value&> PairValue;
   237 
   237 
   238     /// The reference type of map.
   238     /// The reference type of map.
   239     typedef extended_pair<const KeyType&, const KeyType&, 
   239     typedef extended_pair<const Key&, const Key&, 
   240       ConstReferenceType, ConstReferenceType> PairReferenceType;
   240       ConstReference, ConstReference> PairReference;
   241 
   241 
   242     /// Dereference operator for the iterator.
   242     /// Dereference operator for the iterator.
   243     PairReferenceType operator*() {
   243     PairReference operator*() {
   244       return PairReferenceType(Base::it, (*map)[Base::it]);
   244       return PairReference(Base::it, (*map)[Base::it]);
   245     }
   245     }
   246 
   246 
   247     /// The pointer type of the iterator.
   247     /// The pointer type of the iterator.
   248     class PairPointerType {
   248     class PairPointer {
   249       friend class MapConstIterator;
   249       friend class MapConstIterator;
   250     private:
   250     private:
   251       PairReferenceType data;
   251       PairReference data;
   252       PairPointerType(const KeyType& key, ConstReferenceType val) 
   252       PairPointer(const Key& key, ConstReference val) 
   253 	: data(key, val) {}
   253 	: data(key, val) {}
   254     public:
   254     public:
   255       PairReferenceType* operator->() {return &data;}
   255       PairReference* operator->() {return &data;}
   256     };
   256     };
   257 
   257 
   258     /// Arrow operator for the iterator.
   258     /// Arrow operator for the iterator.
   259     PairPointerType operator->() {
   259     PairPointer operator->() {
   260       return PairPointerType(Base::it, (*map)[Base::it]); 
   260       return PairPointer(Base::it, (*map)[Base::it]); 
   261     }
   261     }
   262 
   262 
   263     /// The pre increment operator of the iterator.
   263     /// The pre increment operator of the iterator.
   264     MapConstIterator& operator++() { 
   264     MapConstIterator& operator++() { 
   265       Base::increment(); 
   265       Base::increment(); 
   278 
   278 
   279   public:
   279   public:
   280     // STL  compatibility typedefs.
   280     // STL  compatibility typedefs.
   281     typedef std::input_iterator_tag iterator_category;
   281     typedef std::input_iterator_tag iterator_category;
   282     typedef int difference_type;
   282     typedef int difference_type;
   283     typedef PairValueType value_type;
   283     typedef PairValue value_type;
   284     typedef PairReferenceType reference;
   284     typedef PairReference reference;
   285     typedef PairPointerType pointer;
   285     typedef PairPointer pointer;
   286   };
   286   };
   287 
   287 
   288   /** The class makes the KeyIt to an stl compatible iterator
   288   /** The class makes the KeyIt to an stl compatible iterator
   289    *  with dereferencing operator.
   289    *  with dereferencing operator.
   290    */
   290    */
   295 
   295 
   296     /// The iterator base class.
   296     /// The iterator base class.
   297     typedef MapIteratorBase<Map> Base;
   297     typedef MapIteratorBase<Map> Base;
   298  
   298  
   299     /// The key type of the iterator.
   299     /// The key type of the iterator.
   300     typedef typename Map::KeyType KeyType;
   300     typedef typename Map::Key Key;
   301     /// The iterator to iterate on the keys.
   301     /// The iterator to iterate on the keys.
   302     typedef typename Map::KeyIt KeyIt;
   302     typedef typename Map::KeyIt KeyIt;
   303 
   303 
   304   public:
   304   public:
   305 
   305 
   321       Base::increment();
   321       Base::increment();
   322       return tmp;
   322       return tmp;
   323     }
   323     }
   324 
   324 
   325     /// The dereferencing operator of the iterator.
   325     /// The dereferencing operator of the iterator.
   326     KeyType operator*() const {
   326     Key operator*() const {
   327       return static_cast<KeyType>(Base::it);
   327       return static_cast<Key>(Base::it);
   328     }
   328     }
   329 
   329 
   330   public:
   330   public:
   331     // STL  compatibility typedefs.
   331     // STL  compatibility typedefs.
   332     typedef std::input_iterator_tag iterator_category;
   332     typedef std::input_iterator_tag iterator_category;
   333     typedef int difference_type;
   333     typedef int difference_type;
   334     typedef KeyType value_type;
   334     typedef Key value_type;
   335     typedef const KeyType& reference;
   335     typedef const Key& reference;
   336     typedef const KeyType* pointer;
   336     typedef const Key* pointer;
   337   };
   337   };
   338 
   338 
   339   template <typename Map> class MapConstValueIterator;
   339   template <typename Map> class MapConstValueIterator;
   340 
   340 
   341   /** MapValueIterator creates an stl compatible iterator
   341   /** MapValueIterator creates an stl compatible iterator
   350 
   350 
   351     /// The iterator base class.
   351     /// The iterator base class.
   352     typedef MapIteratorBase<Map> Base;
   352     typedef MapIteratorBase<Map> Base;
   353 
   353 
   354     /// The key type of the iterator.
   354     /// The key type of the iterator.
   355     typedef typename Map::KeyType KeyType;
   355     typedef typename Map::Key Key;
   356     /// The iterator to iterate on the keys.
   356     /// The iterator to iterate on the keys.
   357     typedef typename Map::KeyIt KeyIt;
   357     typedef typename Map::KeyIt KeyIt;
   358 
   358 
   359 
   359 
   360     /// The value type of the iterator.
   360     /// The value type of the iterator.
   361     typedef typename Map::ValueType ValueType;
   361     typedef typename Map::Value Value;
   362     /// The reference type of the iterator.
   362     /// The reference type of the iterator.
   363     typedef typename Map::ReferenceType ReferenceType;
   363     typedef typename Map::Reference Reference;
   364     /// The pointer type of the iterator.
   364     /// The pointer type of the iterator.
   365     typedef typename Map::PointerType PointerType;
   365     typedef typename Map::Pointer Pointer;
   366 
   366 
   367     /// The const value type of the iterator.
   367     /// The const value type of the iterator.
   368     typedef typename Map::ConstValueType ConstValueType;
   368     typedef typename Map::ConstValue ConstValue;
   369     /// The const reference type of the iterator.
   369     /// The const reference type of the iterator.
   370     typedef typename Map::ConstReferenceType ConstReferenceType;
   370     typedef typename Map::ConstReference ConstReference;
   371     /// The pointer type of the iterator.
   371     /// The pointer type of the iterator.
   372     typedef typename Map::ConstPointerType ConstPointerType;
   372     typedef typename Map::ConstPointer ConstPointer;
   373 
   373 
   374   private:
   374   private:
   375 
   375 
   376     Map* map;
   376     Map* map;
   377 
   377 
   397       Base::increment();
   397       Base::increment();
   398       return tmp;
   398       return tmp;
   399     }
   399     }
   400 
   400 
   401     /// The dereferencing operator of the iterator.
   401     /// The dereferencing operator of the iterator.
   402     ReferenceType operator*() const {
   402     Reference operator*() const {
   403       return (*map)[Base::it];
   403       return (*map)[Base::it];
   404     }
   404     }
   405 
   405 
   406     /// The arrow operator of the iterator.
   406     /// The arrow operator of the iterator.
   407     PointerType operator->() const {
   407     Pointer operator->() const {
   408       return &(operator*());
   408       return &(operator*());
   409     }
   409     }
   410 
   410 
   411   public:
   411   public:
   412     // STL  compatibility typedefs.
   412     // STL  compatibility typedefs.
   413     typedef std::forward_iterator_tag iterator_category;
   413     typedef std::forward_iterator_tag iterator_category;
   414     typedef int difference_type;
   414     typedef int difference_type;
   415     typedef ValueType value_type;
   415     typedef Value value_type;
   416     typedef ReferenceType reference;
   416     typedef Reference reference;
   417     typedef PointerType pointer;
   417     typedef Pointer pointer;
   418   };
   418   };
   419 
   419 
   420   /** MapValueIterator creates an stl compatible iterator
   420   /** MapValueIterator creates an stl compatible iterator
   421    *  for the const values.
   421    *  for the const values.
   422    */
   422    */
   428 
   428 
   429     /// The iterator base class.
   429     /// The iterator base class.
   430     typedef MapIteratorBase<Map> Base;
   430     typedef MapIteratorBase<Map> Base;
   431 
   431 
   432     /// The key type of the iterator.
   432     /// The key type of the iterator.
   433     typedef typename Map::KeyType KeyType;
   433     typedef typename Map::Key Key;
   434     /// The iterator to iterate on the keys.
   434     /// The iterator to iterate on the keys.
   435     typedef typename Map::KeyIt KeyIt;
   435     typedef typename Map::KeyIt KeyIt;
   436 
   436 
   437     /// The value type of the iterator.
   437     /// The value type of the iterator.
   438     typedef typename Map::ValueType ValueType;
   438     typedef typename Map::Value Value;
   439     /// The reference type of the iterator.
   439     /// The reference type of the iterator.
   440     typedef typename Map::ReferenceType ReferenceType;
   440     typedef typename Map::Reference Reference;
   441     /// The pointer type of the iterator.
   441     /// The pointer type of the iterator.
   442     typedef typename Map::PointerType PointerType;
   442     typedef typename Map::Pointer Pointer;
   443 
   443 
   444     /// The const value type of the iterator.
   444     /// The const value type of the iterator.
   445     typedef typename Map::ConstValueType ConstValueType;
   445     typedef typename Map::ConstValue ConstValue;
   446     /// The const reference type of the iterator.
   446     /// The const reference type of the iterator.
   447     typedef typename Map::ConstReferenceType ConstReferenceType;
   447     typedef typename Map::ConstReference ConstReference;
   448     /// The pointer type of the iterator.
   448     /// The pointer type of the iterator.
   449     typedef typename Map::ConstPointerType ConstPointerType;
   449     typedef typename Map::ConstPointer ConstPointer;
   450 
   450 
   451   private:
   451   private:
   452 
   452 
   453     const Map* map;
   453     const Map* map;
   454 
   454 
   479       Base::increment();
   479       Base::increment();
   480       return tmp;
   480       return tmp;
   481     }
   481     }
   482 
   482 
   483     /// The dereferencing operator of the iterator.
   483     /// The dereferencing operator of the iterator.
   484     ConstReferenceType operator*() const {
   484     ConstReference operator*() const {
   485       return (*map)[Base::it];
   485       return (*map)[Base::it];
   486     }
   486     }
   487 
   487 
   488     /// The arrow operator of the iterator.
   488     /// The arrow operator of the iterator.
   489     ConstPointerType operator->() const {
   489     ConstPointer operator->() const {
   490       return &(operator*());
   490       return &(operator*());
   491     }
   491     }
   492 
   492 
   493   public:
   493   public:
   494     // STL  compatibility typedefs.
   494     // STL  compatibility typedefs.
   495     typedef std::input_iterator_tag iterator_category;
   495     typedef std::input_iterator_tag iterator_category;
   496     typedef int difference_type;
   496     typedef int difference_type;
   497     typedef ValueType value_type;
   497     typedef Value value_type;
   498     typedef ConstReferenceType reference;
   498     typedef ConstReference reference;
   499     typedef ConstPointerType pointer;
   499     typedef ConstPointer pointer;
   500   };
   500   };
   501 
   501 
   502 
   502 
   503   /** This class makes from a map an iteratable set
   503   /** This class makes from a map an iteratable set
   504    *  which contains all the keys of the map.
   504    *  which contains all the keys of the map.
   509     const Map* map;
   509     const Map* map;
   510 
   510 
   511   public:
   511   public:
   512 
   512 
   513     /// The key type of the iterator.
   513     /// The key type of the iterator.
   514     typedef typename Map::KeyType KeyType;
   514     typedef typename Map::Key Key;
   515     /// The iterator to iterate on the keys.
   515     /// The iterator to iterate on the keys.
   516     typedef typename Map::KeyIt KeyIt;
   516     typedef typename Map::KeyIt KeyIt;
   517 
   517 
   518 
   518 
   519     /// The value type of the iterator.
   519     /// The value type of the iterator.
   520     typedef typename Map::ValueType ValueType;
   520     typedef typename Map::Value Value;
   521     /// The reference type of the iterator.
   521     /// The reference type of the iterator.
   522     typedef typename Map::ReferenceType ReferenceType;
   522     typedef typename Map::Reference Reference;
   523     /// The pointer type of the iterator.
   523     /// The pointer type of the iterator.
   524     typedef typename Map::PointerType PointerType;
   524     typedef typename Map::Pointer Pointer;
   525 
   525 
   526     /// The const value type of the iterator.
   526     /// The const value type of the iterator.
   527     typedef typename Map::ConstValueType ConstValueType;
   527     typedef typename Map::ConstValue ConstValue;
   528     /// The const reference type of the iterator.
   528     /// The const reference type of the iterator.
   529     typedef typename Map::ConstReferenceType ConstReferenceType;
   529     typedef typename Map::ConstReference ConstReference;
   530     /// The pointer type of the iterator.
   530     /// The pointer type of the iterator.
   531     typedef typename Map::ConstPointerType ConstPointerType;
   531     typedef typename Map::ConstPointer ConstPointer;
   532 
   532 
   533     /// The map initialized const key set.
   533     /// The map initialized const key set.
   534     MapConstKeySet(const Map& pmap) : map(&pmap) {}
   534     MapConstKeySet(const Map& pmap) : map(&pmap) {}
   535 
   535 
   536     /// The const iterator of the set.
   536     /// The const iterator of the set.
   546       return ConstIterator(KeyIt(INVALID));
   546       return ConstIterator(KeyIt(INVALID));
   547     }
   547     }
   548  
   548  
   549   public:
   549   public:
   550     // STL  compatibility typedefs.
   550     // STL  compatibility typedefs.
   551     typedef ValueType value_type;
   551     typedef Value value_type;
   552     typedef ConstIterator const_iterator;
   552     typedef ConstIterator const_iterator;
   553     typedef ConstReferenceType const_reference;
   553     typedef ConstReference const_reference;
   554     typedef ConstPointerType const_pointer;
   554     typedef ConstPointer const_pointer;
   555     typedef int difference_type;
   555     typedef int difference_type;
   556   };
   556   };
   557 
   557 
   558   /** This class makes from a map an iteratable set
   558   /** This class makes from a map an iteratable set
   559    *  which contains all the values of the map.
   559    *  which contains all the values of the map.
   565     const Map* map;
   565     const Map* map;
   566 
   566 
   567   public:
   567   public:
   568 
   568 
   569     /// The key type of the iterator.
   569     /// The key type of the iterator.
   570     typedef typename Map::KeyType KeyType;
   570     typedef typename Map::Key Key;
   571     /// The iterator to iterate on the keys.
   571     /// The iterator to iterate on the keys.
   572     typedef typename Map::KeyIt KeyIt;
   572     typedef typename Map::KeyIt KeyIt;
   573 
   573 
   574 
   574 
   575     /// The value type of the iterator.
   575     /// The value type of the iterator.
   576     typedef typename Map::ValueType ValueType;
   576     typedef typename Map::Value Value;
   577     /// The reference type of the iterator.
   577     /// The reference type of the iterator.
   578     typedef typename Map::ReferenceType ReferenceType;
   578     typedef typename Map::Reference Reference;
   579     /// The pointer type of the iterator.
   579     /// The pointer type of the iterator.
   580     typedef typename Map::PointerType PointerType;
   580     typedef typename Map::Pointer Pointer;
   581 
   581 
   582     /// The const value type of the iterator.
   582     /// The const value type of the iterator.
   583     typedef typename Map::ConstValueType ConstValueType;
   583     typedef typename Map::ConstValue ConstValue;
   584     /// The const reference type of the iterator.
   584     /// The const reference type of the iterator.
   585     typedef typename Map::ConstReferenceType ConstReferenceType;
   585     typedef typename Map::ConstReference ConstReference;
   586     /// The pointer type of the iterator.
   586     /// The pointer type of the iterator.
   587     typedef typename Map::ConstPointerType ConstPointerType;
   587     typedef typename Map::ConstPointer ConstPointer;
   588 
   588 
   589     /// The map initialized const value set.
   589     /// The map initialized const value set.
   590     MapConstValueSet(const Map& pmap) : map(&pmap) {}
   590     MapConstValueSet(const Map& pmap) : map(&pmap) {}
   591 
   591 
   592     /// The const iterator of the set.
   592     /// The const iterator of the set.
   602       return ConstIterator(*map, KeyIt(INVALID));
   602       return ConstIterator(*map, KeyIt(INVALID));
   603     }
   603     }
   604 
   604 
   605   public:
   605   public:
   606     // STL  compatibility typedefs.
   606     // STL  compatibility typedefs.
   607     typedef ValueType value_type;
   607     typedef Value value_type;
   608     typedef ConstIterator const_iterator;
   608     typedef ConstIterator const_iterator;
   609     typedef ConstReferenceType const_reference;
   609     typedef ConstReference const_reference;
   610     typedef ConstPointerType const_pointer;
   610     typedef ConstPointer const_pointer;
   611     typedef int difference_type;
   611     typedef int difference_type;
   612   };
   612   };
   613 
   613 
   614 
   614 
   615   /** This class makes from a map an iteratable set
   615   /** This class makes from a map an iteratable set
   622     Map* map;
   622     Map* map;
   623 
   623 
   624   public:
   624   public:
   625 
   625 
   626     /// The key type of the iterator.
   626     /// The key type of the iterator.
   627     typedef typename Map::KeyType KeyType;
   627     typedef typename Map::Key Key;
   628     /// The iterator to iterate on the keys.
   628     /// The iterator to iterate on the keys.
   629     typedef typename Map::KeyIt KeyIt;
   629     typedef typename Map::KeyIt KeyIt;
   630 
   630 
   631 
   631 
   632     /// The value type of the iterator.
   632     /// The value type of the iterator.
   633     typedef typename Map::ValueType ValueType;
   633     typedef typename Map::Value Value;
   634     /// The reference type of the iterator.
   634     /// The reference type of the iterator.
   635     typedef typename Map::ReferenceType ReferenceType;
   635     typedef typename Map::Reference Reference;
   636     /// The pointer type of the iterator.
   636     /// The pointer type of the iterator.
   637     typedef typename Map::PointerType PointerType;
   637     typedef typename Map::Pointer Pointer;
   638 
   638 
   639     /// The const value type of the iterator.
   639     /// The const value type of the iterator.
   640     typedef typename Map::ConstValueType ConstValueType;
   640     typedef typename Map::ConstValue ConstValue;
   641     /// The const reference type of the iterator.
   641     /// The const reference type of the iterator.
   642     typedef typename Map::ConstReferenceType ConstReferenceType;
   642     typedef typename Map::ConstReference ConstReference;
   643     /// The pointer type of the iterator.
   643     /// The pointer type of the iterator.
   644     typedef typename Map::ConstPointerType ConstPointerType;
   644     typedef typename Map::ConstPointer ConstPointer;
   645 
   645 
   646     /// The map initialized value set.
   646     /// The map initialized value set.
   647     MapValueSet(Map& pmap) : map(&pmap) {}
   647     MapValueSet(Map& pmap) : map(&pmap) {}
   648 
   648 
   649     /// The const iterator of the set.
   649     /// The const iterator of the set.
   672       return Iterator(*map, KeyIt(INVALID));
   672       return Iterator(*map, KeyIt(INVALID));
   673     }
   673     }
   674             
   674             
   675   public:
   675   public:
   676     // STL  compatibility typedefs.
   676     // STL  compatibility typedefs.
   677     typedef ValueType value_type;
   677     typedef Value value_type;
   678     typedef Iterator iterator;
   678     typedef Iterator iterator;
   679     typedef ConstIterator const_iterator;
   679     typedef ConstIterator const_iterator;
   680     typedef ReferenceType reference;
   680     typedef Reference reference;
   681     typedef ConstReferenceType const_reference;
   681     typedef ConstReference const_reference;
   682     typedef PointerType pointer;
   682     typedef Pointer pointer;
   683     typedef ConstPointerType const_pointer;
   683     typedef ConstPointer const_pointer;
   684     typedef int difference_type;
   684     typedef int difference_type;
   685 
   685 
   686   };
   686   };
   687 
   687 
   688   /// @}
   688   /// @}