lemon/maps.h
changeset 1531 a3b20dd847b5
parent 1456 5289afbdb720
child 1536 308150155bb5
     1.1 --- a/lemon/maps.h	Mon Jul 04 13:08:31 2005 +0000
     1.2 +++ b/lemon/maps.h	Mon Jul 04 13:10:34 2005 +0000
     1.3 @@ -206,6 +206,20 @@
     1.4    /// \addtogroup map_adaptors
     1.5    /// @{
     1.6  
     1.7 +  /// \brief Identity mapping.
     1.8 +  ///
     1.9 +  /// This mapping gives back the given key as value without any
    1.10 +  /// modification. 
    1.11 +  template <typename T>
    1.12 +  class IdentityMap {
    1.13 +  public:
    1.14 +    typedef T Key;
    1.15 +    typedef T Value;
    1.16 +
    1.17 +    const Value& operator[](const Key& t) const {
    1.18 +      return t;
    1.19 +    }
    1.20 +  };
    1.21  
    1.22    ///Convert the \c Value of a maps to another type.
    1.23