Index: lemon/maps.h
===================================================================
--- lemon/maps.h	(revision 1669)
+++ lemon/maps.h	(revision 1675)
@@ -40,8 +40,9 @@
   /// Base class of maps.
   /// It provides the necessary <tt>typedef</tt>s required by the map concept.
-  template<typename K, typename T>
-  class MapBase
-  {
-  public:
+  template<typename K, typename T, typename _NeedCopy = False>
+  class MapBase {
+  public:
+    /// \e
+    typedef _NeedCopy NeedCopy;
     ///\e
     typedef K Key;
@@ -55,11 +56,11 @@
   /// or if you have to provide a writable map, but
   /// data written to it will sent to <tt>/dev/null</tt>...
-  template<typename K, typename T>
-  class NullMap : public MapBase<K,T>
-  {
-  public:
+  template<typename K, typename T, typename NC = False>
+  class NullMap : public MapBase<K, T, NC> {
+  public:
+    typedef MapBase<K, T, NC> Parent;
+    typedef typename Parent::Key Key;
+    typedef typename Parent::Value Value;
     
-    typedef True NeedCopy;
-
     /// Gives back a default constructed element.
     T operator[](const K&) const { return T(); }
@@ -69,6 +70,6 @@
 
   template <typename K, typename V> 
-  NullMap<K, V> nullMap() {
-    return NullMap<K, V>();
+  NullMap<K, V, True> nullMap() {
+    return NullMap<K, V, True>();
   }
 
@@ -79,11 +80,13 @@
   /// In other aspects it is equivalent to the \ref NullMap.
   /// \todo set could be used to set the value.
-  template<typename K, typename T>
-  class ConstMap : public MapBase<K,T>
-  {
+  template<typename K, typename T, typename NC = False>
+  class ConstMap : public MapBase<K, T, NC> {
+  private:
     T v;
   public:
 
-    typedef True NeedCopy;
+    typedef MapBase<K, T, NC> Parent;
+    typedef typename Parent::Key Key;
+    typedef typename Parent::Value Value;
 
     /// Default constructor
@@ -103,9 +106,9 @@
     template<typename T1>
     struct rebind {
-      typedef ConstMap<K,T1> other;
+      typedef ConstMap<K, T1> other;
     };
 
     template<typename T1>
-    ConstMap(const ConstMap<K,T1> &, const T &_v) : v(_v) {}
+    ConstMap(const ConstMap<K, T1> &, const T &_v) : v(_v) {}
   };
 
@@ -114,8 +117,7 @@
   ///This function just returns a \ref ConstMap class.
   ///\relates ConstMap
-  template<class K,class V> 
-  inline ConstMap<K,V> constMap(const V &v) 
-  {
-    return ConstMap<K,V>(v);
+  template<typename K, typename V> 
+  inline ConstMap<K, V, True> constMap(const V &v) {
+    return ConstMap<K, V, True>(v);
   }
 
@@ -124,9 +126,13 @@
   template<typename T, T v>
   struct Const { };
+
   //\todo to document later
-  template<typename K, typename V, V v>
-  class ConstMap<K, Const<V, v> > : public MapBase<K, V>
-  {
-  public:
+  template<typename K, typename V, V v, typename NC>
+  class ConstMap<K, Const<V, v>, NC > : public MapBase<K, V, NC> {
+  public:
+    typedef MapBase<K, V, False> Parent;
+    typedef typename Parent::Key Key;
+    typedef typename Parent::Value Value;
+
     ConstMap() { }
     V operator[](const K&) const { return v; }
@@ -134,4 +140,13 @@
   };
 
+  ///Returns a \ref ConstMap class
+
+  ///This function just returns a \ref ConstMap class.
+  ///\relates ConstMap
+  template<typename K, typename V, V v> 
+  inline ConstMap<K, Const<V, v>, True> constMap() {
+    return ConstMap<K, Const<V, v>, True>();
+  }
+
   /// \c std::map wrapper
 
@@ -141,6 +156,6 @@
   /// \todo Provide allocator parameter...
   template <typename K, typename T, typename Compare = std::less<K> >
-  class StdMap : public std::map<K,T,Compare> {
-    typedef std::map<K,T,Compare> parent;
+  class StdMap : public std::map<K, T, Compare> {
+    typedef std::map<K, T, Compare> parent;
     T v;
     typedef typename parent::value_type PairType;
@@ -172,5 +187,5 @@
     
     template<typename T1, typename Comp1>
-    StdMap(const StdMap<Key,T1,Comp1> &m, const T &_v) { 
+    StdMap(const StdMap<Key, T1,Comp1> &m, const T &_v) { 
       //FIXME; 
     }
@@ -179,4 +194,5 @@
       return insert(PairType(k,v)).first -> second;
     }
+
     ConstReference operator[](const Key &k) const {
       typename parent::iterator i = lower_bound(k);
@@ -198,5 +214,5 @@
     template<typename T1>
     struct rebind {
-      typedef StdMap<Key,T1,Compare> other;
+      typedef StdMap<Key, T1,Compare> other;
     };
   };
@@ -211,14 +227,25 @@
   /// This mapping gives back the given key as value without any
   /// modification. 
-  template <typename T>
-  class IdentityMap {
-  public:
-    typedef T Key;
-    typedef T Value;
-
-    const Value& operator[](const Key& t) const {
+  template <typename T, typename NC = False>
+  class IdentityMap : public MapBase<T, T, NC> {
+  public:
+    typedef MapBase<T, T, NC> Parent;
+    typedef typename Parent::Key Key;
+    typedef typename Parent::Value Value;
+
+    const T& operator[](const T& t) const {
       return t;
     }
   };
+
+  ///Returns an \ref IdentityMap class
+
+  ///This function just returns an \ref IdentityMap class.
+  ///\relates IdentityMap
+  template<typename T>
+  inline IdentityMap<T, True> identityMap() {
+    return IdentityMap<T, True>();
+  }
+  
 
   ///Convert the \c Value of a map to another type.
@@ -227,15 +254,11 @@
   ///converts the \c Value of a maps to type \c T.
   ///Its \c Key is inherited from \c M.
-  template<class M, class T> 
-  class ConvertMap {
+  template <typename M, typename T, typename NC = False> 
+  class ConvertMap : public MapBase<typename M::Key, T, NC> {
     typename SmartConstReference<M>::Type m;
   public:
-
-    typedef True NeedCopy;
-
-    ///\e
-    typedef typename M::Key Key;
-    ///\e
-    typedef T Value;
+    typedef MapBase<typename M::Key, T, NC> Parent;
+    typedef typename Parent::Key Key;
+    typedef typename Parent::Value Value;
 
     ///Constructor
@@ -250,5 +273,5 @@
     /// \param k The key
     /// \return The target of the edge 
-    Value operator[](Key k) const {return m[k];}
+    Value operator[](const Key& k) const {return m[k];}
   };
   
@@ -258,8 +281,7 @@
   ///\relates ConvertMap
   ///\todo The order of the template parameters are changed.
-  template<class T, class M>
-  inline ConvertMap<M,T> convertMap(const M &m) 
-  {
-    return ConvertMap<M,T>(m);
+  template<typename T, typename M>
+  inline ConvertMap<M, T, True> convertMap(const M &m) {
+    return ConvertMap<M, T, True>(m);
   }
 
@@ -270,18 +292,13 @@
   ///The \c Key and \c Value of M2 must be convertible to those of \c M1.
 
-  template<class M1,class M2> 
-  class AddMap
-  {
+  template<typename M1, typename M2, typename NC = False> 
+  class AddMap : public MapBase<typename M1::Key, typename M1::Value, NC> {
     typename SmartConstReference<M1>::Type m1;
     typename SmartConstReference<M2>::Type m2;
 
   public:
-
-    typedef True NeedCopy;
-
-    ///\e
-    typedef typename M1::Key Key;
-    ///\e
-    typedef typename M1::Value Value;
+    typedef MapBase<typename M1::Key, typename M1::Value, NC> Parent;
+    typedef typename Parent::Key Key;
+    typedef typename Parent::Value Value;
 
     ///Constructor
@@ -297,8 +314,7 @@
   ///\relates AddMap
   ///\todo Wrong scope in Doxygen when \c \\relates is used
-  template<class M1,class M2> 
-  inline AddMap<M1,M2> addMap(const M1 &m1,const M2 &m2) 
-  {
-    return AddMap<M1,M2>(m1,m2);
+  template<typename M1, typename M2> 
+  inline AddMap<M1, M2, True> addMap(const M1 &m1,const M2 &m2) {
+    return AddMap<M1, M2, True>(m1,m2);
   }
 
@@ -318,16 +334,12 @@
   ///  AddMap<X, ConstMap<X::Key, X::Value> > sh(x,v);
   ///\endcode
-  template<class M> 
-  class ShiftMap
-  {
+  template<typename M, typename NC = False> 
+  class ShiftMap : public MapBase<typename M::Key, typename M::Value, NC> {
     typename SmartConstReference<M>::Type m;
     typename M::Value v;
   public:
-
-    typedef True NeedCopy;
-    ///\e
-    typedef typename M::Key Key;
-    ///\e
-    typedef typename M::Value Value;
+    typedef MapBase<typename M::Key, typename M::Value, NC> Parent;
+    typedef typename Parent::Key Key;
+    typedef typename Parent::Value Value;
 
     ///Constructor
@@ -336,5 +348,5 @@
     ///\param _m is the undelying map
     ///\param _v is the shift value
-    ShiftMap(const M &_m,const Value &_v ) : m(_m), v(_v) {};
+    ShiftMap(const M &_m, const Value &_v ) : m(_m), v(_v) {};
     Value operator[](Key k) const {return m[k]+v;}
   };
@@ -345,8 +357,7 @@
   ///\relates ShiftMap
   ///\todo A better name is required.
-  template<class M> 
-  inline ShiftMap<M> shiftMap(const M &m,const typename M::Value &v) 
-  {
-    return ShiftMap<M>(m,v);
+  template<typename M> 
+  inline ShiftMap<M, True> shiftMap(const M &m,const typename M::Value &v) {
+    return ShiftMap<M, True>(m,v);
   }
 
@@ -358,16 +369,12 @@
   ///The \c Key and \c Value of \c M2 must be convertible to those of \c M1.
 
-  template<class M1,class M2> 
-  class SubMap
-  {
+  template<typename M1, typename M2, typename NC = False> 
+  class SubMap : public MapBase<typename M1::Key, typename M1::Value, NC> {
     typename SmartConstReference<M1>::Type m1;
     typename SmartConstReference<M2>::Type m2;
   public:
-
-    typedef True NeedCopy;
-    ///\e
-    typedef typename M1::Key Key;
-    ///\e
-    typedef typename M1::Value Value;
+    typedef MapBase<typename M1::Key, typename M1::Value, NC> Parent;
+    typedef typename Parent::Key Key;
+    typedef typename Parent::Value Value;
 
     ///Constructor
@@ -381,8 +388,7 @@
   ///
   ///\relates SubMap
-  template<class M1,class M2> 
-  inline SubMap<M1,M2> subMap(const M1 &m1,const M2 &m2) 
-  {
-    return SubMap<M1,M2>(m1,m2);
+  template<typename M1, typename M2> 
+  inline SubMap<M1, M2, True> subMap(const M1 &m1, const M2 &m2) {
+    return SubMap<M1, M2, True>(m1, m2);
   }
 
@@ -395,16 +401,12 @@
   ///The \c Key and \c Value of \c M2 must be convertible to those of \c M1.
 
-  template<class M1,class M2> 
-  class MulMap
-  {
+  template<typename M1, typename M2, typename NC = False> 
+  class MulMap : public MapBase<typename M1::Key, typename M1::Value, NC> {
     typename SmartConstReference<M1>::Type m1;
     typename SmartConstReference<M2>::Type m2;
   public:
-
-    typedef True NeedCopy;
-    ///\e
-    typedef typename M1::Key Key;
-    ///\e
-    typedef typename M1::Value Value;
+    typedef MapBase<typename M1::Key, typename M1::Value, NC> Parent;
+    typedef typename Parent::Key Key;
+    typedef typename Parent::Value Value;
 
     ///Constructor
@@ -417,8 +419,7 @@
   ///This function just returns a \ref MulMap class.
   ///\relates MulMap
-  template<class M1,class M2> 
-  inline MulMap<M1,M2> mulMap(const M1 &m1,const M2 &m2) 
-  {
-    return MulMap<M1,M2>(m1,m2);
+  template<typename M1, typename M2> 
+  inline MulMap<M1, M2, True> mulMap(const M1 &m1,const M2 &m2) {
+    return MulMap<M1, M2, True>(m1,m2);
   }
  
@@ -438,16 +439,12 @@
   ///  MulMap<X, ConstMap<X::Key, X::Value> > sc(x,v);
   ///\endcode
-  template<class M> 
-  class ScaleMap
-  {
+  template<typename M, typename NC = False> 
+  class ScaleMap : public MapBase<typename M::Key, typename M::Value, NC> {
     typename SmartConstReference<M>::Type m;
     typename M::Value v;
   public:
-
-    typedef True NeedCopy;
-    ///\e
-    typedef typename M::Key Key;
-    ///\e
-    typedef typename M::Value Value;
+    typedef MapBase<typename M::Key, typename M::Value, NC> Parent;
+    typedef typename Parent::Key Key;
+    typedef typename Parent::Value Value;
 
     ///Constructor
@@ -465,8 +462,7 @@
   ///\relates ScaleMap
   ///\todo A better name is required.
-  template<class M> 
-  inline ScaleMap<M> scaleMap(const M &m,const typename M::Value &v) 
-  {
-    return ScaleMap<M>(m,v);
+  template<typename M> 
+  inline ScaleMap<M, True> scaleMap(const M &m,const typename M::Value &v) {
+    return ScaleMap<M, True>(m,v);
   }
 
@@ -478,16 +474,12 @@
   ///The \c Key and \c Value of \c M2 must be convertible to those of \c M1.
 
-  template<class M1,class M2> 
-  class DivMap
-  {
+  template<typename M1, typename M2, typename NC = False> 
+  class DivMap : public MapBase<typename M1::Key, typename M1::Value, NC> {
     typename SmartConstReference<M1>::Type m1;
     typename SmartConstReference<M2>::Type m2;
   public:
-
-    typedef True NeedCopy;
-    ///\e
-    typedef typename M1::Key Key;
-    ///\e
-    typedef typename M1::Value Value;
+    typedef MapBase<typename M1::Key, typename M1::Value, NC> Parent;
+    typedef typename Parent::Key Key;
+    typedef typename Parent::Value Value;
 
     ///Constructor
@@ -500,8 +492,7 @@
   ///This function just returns a \ref DivMap class.
   ///\relates DivMap
-  template<class M1,class M2> 
-  inline DivMap<M1,M2> divMap(const M1 &m1,const M2 &m2) 
-  {
-    return DivMap<M1,M2>(m1,m2);
+  template<typename M1, typename M2> 
+  inline DivMap<M1, M2, True> divMap(const M1 &m1,const M2 &m2) {
+    return DivMap<M1, M2, True>(m1,m2);
   }
   
@@ -514,5 +505,5 @@
   ///then for
   ///\code
-  ///  ComposeMap<M1,M2> cm(m1,m2);
+  ///  ComposeMap<M1, M2> cm(m1,m2);
   ///\endcode
   /// <tt>cm[x]</tt> will be equal to <tt>m1[m2[x]]</tt>
@@ -523,16 +514,12 @@
   ///\todo Check the requirements.
 
-  template<class M1,class M2> 
-  class ComposeMap
-  {
+  template <typename M1, typename M2, typename NC = False> 
+  class ComposeMap : public MapBase<typename M2::Key, typename M1::Value, NC> {
     typename SmartConstReference<M1>::Type m1;
     typename SmartConstReference<M2>::Type m2;
   public:
-
-    typedef True NeedCopy;
-    ///\e
-    typedef typename M2::Key Key;
-    ///\e
-    typedef typename M1::Value Value;
+    typedef MapBase<typename M2::Key, typename M1::Value, NC> Parent;
+    typedef typename Parent::Key Key;
+    typedef typename Parent::Value Value;
 
     ///Constructor
@@ -545,8 +532,7 @@
   ///
   ///\relates ComposeMap
-  template<class M1,class M2> 
-  inline ComposeMap<M1,M2> composeMap(const M1 &m1,const M2 &m2) 
-  {
-    return ComposeMap<M1,M2>(m1,m2);
+  template <typename M1, typename M2> 
+  inline ComposeMap<M1, M2, True> composeMap(const M1 &m1,const M2 &m2) {
+    return ComposeMap<M1, M2, True>(m1,m2);
   }
   
@@ -564,5 +550,5 @@
   ///then for
   ///\code
-  ///  CombineMap<M1,M2,F,V> cm(m1,m2,f);
+  ///  CombineMap<M1, M2,F,V> cm(m1,m2,f);
   ///\endcode
   /// <tt>cm[x]</tt> will be equal to <tt>f(m1[x],m2[x])</tt>
@@ -574,17 +560,15 @@
   ///\todo Check the requirements.
 
-  template<class M1,class M2,class F,class V = typename F::result_type> 
-  class CombineMap
-  {
+  template<typename M1, typename M2, typename F,
+	   typename V = typename F::result_type,
+	   typename NC = False> 
+  class CombineMap : public MapBase<typename M1::Key, V, NC> {
     typename SmartConstReference<M1>::Type m1;
     typename SmartConstReference<M2>::Type m2;
     F f;
   public:
-
-    typedef True NeedCopy;
-    ///\e
-    typedef typename M1::Key Key;
-    ///\e
-    typedef V Value;
+    typedef MapBase<typename M1::Key, V, NC> Parent;
+    typedef typename Parent::Key Key;
+    typedef typename Parent::Value Value;
 
     ///Constructor
@@ -610,8 +594,20 @@
   ///
   ///\relates CombineMap
-  template<class M1,class M2,class F> 
-  inline CombineMap<M1,M2,F> combineMap(const M1 &m1,const M2 &m2,const F &f) 
-  {
-    return CombineMap<M1,M2,F>(m1,m2,f);
+  template<typename M1, typename M2, typename F, typename V> 
+  inline CombineMap<M1, M2, F, V, True> 
+  combineMap(const M1& m1,const M2& m2, const F& f) {
+    return CombineMap<M1, M2, F, V, True>(m1,m2,f);
+  }
+
+  template<typename M1, typename M2, typename F> 
+  inline CombineMap<M1, M2, F, typename F::result_type, True> 
+  combineMap(const M1& m1, const M2& m2, const F& f) {
+    return combineMap<M1, M2, F, typename F::result_type>(m1,m2,f);
+  }
+
+  template<typename M1, typename M2, typename K1, typename K2, typename V> 
+  inline CombineMap<M1, M2, V (*)(K1, K2), V, True> 
+  combineMap(const M1 &m1, const M2 &m2, V (*f)(K1, K2)) {
+    return combineMap<M1, M2, V (*)(K1, K2), V>(m1,m2,f);
   }
 
@@ -624,15 +620,11 @@
   ///The unary \c - operator must be defined for \c Value, of course.
 
-  template<class M> 
-  class NegMap
-  {
+  template<typename M, typename NC = False> 
+  class NegMap : public MapBase<typename M::Key, typename M::Value, NC> {
     typename SmartConstReference<M>::Type m;
   public:
-
-    typedef True NeedCopy;
-    ///\e
-    typedef typename M::Key Key;
-    ///\e
-    typedef typename M::Value Value;
+    typedef MapBase<typename M::Key, typename M::Value, NC> Parent;
+    typedef typename Parent::Key Key;
+    typedef typename Parent::Value Value;
 
     ///Constructor
@@ -645,8 +637,7 @@
   ///This function just returns a \ref NegMap class.
   ///\relates NegMap
-  template<class M> 
-  inline NegMap<M> negMap(const M &m) 
-  {
-    return NegMap<M>(m);
+  template <typename M> 
+  inline NegMap<M, True> negMap(const M &m) {
+    return NegMap<M, True>(m);
   }
 
@@ -675,19 +666,19 @@
   
 
-  template<class M> 
-  class AbsMap
-  {
+  template<typename M, typename NC = False> 
+  class AbsMap : public MapBase<typename M::Key, typename M::Value, NC> {
     typename SmartConstReference<M>::Type m;
   public:
-
-    typedef True NeedCopy;
-    ///\e
-    typedef typename M::Key Key;
-    ///\e
-    typedef typename M::Value Value;
+    typedef MapBase<typename M::Key, typename M::Value, NC> Parent;
+    typedef typename Parent::Key Key;
+    typedef typename Parent::Value Value;
 
     ///Constructor
     AbsMap(const M &_m) : m(_m) {};
-    Value operator[](Key k) const {Value tmp=m[k]; return tmp>=0?tmp:-tmp;}
+    Value operator[](Key k) const {
+      Value tmp = m[k]; 
+      return tmp >= 0 ? tmp : -tmp;
+    }
+
   };
   
@@ -696,8 +687,7 @@
   ///This function just returns a \ref AbsMap class.
   ///\relates AbsMap
-  template<class M> 
-  inline AbsMap<M> absMap(const M &m) 
-  {
-    return AbsMap<M>(m);
+  template<typename M> 
+  inline AbsMap<M, True> absMap(const M &m) {
+    return AbsMap<M, True>(m);
   }
 
@@ -715,15 +705,14 @@
   
 
-  template<class K,class V,class F> 
-  class FunctorMap
-  {
+  template<typename F, 
+	   typename K = typename F::argument_type, 
+	   typename V = typename F::result_type,
+	   typename NC = False> 
+  class FunctorMap : public MapBase<K, V, NC> {
     const F &f;
   public:
-
-    typedef True NeedCopy;
-    ///\e
-    typedef K Key;
-    ///\e
-    typedef V Value;
+    typedef MapBase<K, V, NC> Parent;
+    typedef typename Parent::Key Key;
+    typedef typename Parent::Value Value;
 
     ///Constructor
@@ -738,9 +727,21 @@
   ///The third template parameter isn't necessary to be given.
   ///\relates FunctorMap
-  template<class K,class V, class F>
-  inline FunctorMap<K,V,F> functorMap(const F &f) 
-  {
-    return FunctorMap<K,V,F>(f);
-  }
+  template<typename K, typename V, typename F> inline 
+  FunctorMap<F, K, V, True> functorMap(const F &f) {
+    return FunctorMap<F, K, V, True>(f);
+  }
+
+  template <typename F> inline 
+  FunctorMap<F, typename F::argument_type, typename F::result_type, True> 
+  functorMap(const F &f) {
+    return functorMap<typename F::argument_type, 
+      typename F::result_type, F>(f);
+  }
+
+  template <typename K, typename V> inline 
+  FunctorMap<V (*)(K), K, V, True> functorMap(V (*f)(K)) {
+    return functorMap<K, V, V (*)(K)>(f);
+  }
+
 
   ///Converts a map to an STL style (unary) functor
@@ -753,19 +754,16 @@
   ///i.e. <tt>operator[]</tt> and the \c Key and \c Value typedefs also exist.
 
-  template<class M> 
-  class MapFunctor
-  {
+  template <typename M, typename NC = False> 
+  class MapFunctor : public MapBase<typename M::Key, typename M::Value, NC> {
     typename SmartConstReference<M>::Type m;
   public:
-
-    typedef True NeedCopy;
+    typedef MapBase<typename M::Key, typename M::Value, NC> Parent;
+    typedef typename Parent::Key Key;
+    typedef typename Parent::Value Value;
+
     ///\e
     typedef typename M::Key argument_type;
     ///\e
     typedef typename M::Value result_type;
-    ///\e
-    typedef typename M::Key Key;
-    ///\e
-    typedef typename M::Value Value;
 
     ///Constructor
@@ -781,8 +779,7 @@
   ///This function just returns a \ref MapFunctor class.
   ///\relates MapFunctor
-  template<class M> 
-  inline MapFunctor<M> mapFunctor(const M &m) 
-  {
-    return MapFunctor<M>(m);
+  template<typename M> 
+  inline MapFunctor<M, True> mapFunctor(const M &m) {
+    return MapFunctor<M, True>(m);
   }
 
@@ -799,21 +796,17 @@
   ///The \c Key and \c Value of M2 must be convertible from those of \c M1.
 
-  template<class M1,class M2> 
-  class ForkMap
-  {
+  template<typename  M1, typename M2, typename NC = False> 
+  class ForkMap : public MapBase<typename M1::Key, typename M1::Value, NC> {
     typename SmartConstReference<M1>::Type m1;
     typename SmartConstReference<M2>::Type m2;
   public:
-
-    typedef True NeedCopy;
-    ///\e
-    typedef typename M1::Key Key;
-    ///\e
-    typedef typename M1::Value Value;
+    typedef MapBase<typename M1::Key, typename M1::Value, NC> Parent;
+    typedef typename Parent::Key Key;
+    typedef typename Parent::Value Value;
 
     ///Constructor
     ForkMap(const M1 &_m1,const M2 &_m2) : m1(_m1), m2(_m2) {};
     Value operator[](Key k) const {return m1[k];}
-    void set(Key k,const Value &v) {m1.set(k,v); m2.set(k,v);}
+    //    void set(Key k, const Value &v) {m1.set(k,v); m2.set(k,v);}
   };
   
@@ -825,8 +818,7 @@
   ///\relates ForkMap
   ///\todo Wrong scope in Doxygen when \c \\relates is used
-  template<class M1,class M2> 
-  inline ForkMap<M1,M2> forkMap(const M1 &m1,const M2 &m2) 
-  {
-    return ForkMap<M1,M2>(m1,m2);
+  template <typename M1, typename M2> 
+  inline ForkMap<M1, M2, True> forkMap(const M1 &m1,const M2 &m2) {
+    return ForkMap<M1, M2, True>(m1,m2);
   }
 
@@ -843,15 +835,11 @@
   ///its Value is <tt>bool</tt>.
 
-  template<class M> 
-  class NotMap
-  {
+  template <typename M, typename NC = False> 
+  class NotMap : public MapBase<typename M::Key, bool, NC> {
     typename SmartConstReference<M>::Type m;
   public:
-
-    typedef True NeedCopy;
-    ///\e
-    typedef typename M::Key Key;
-    ///\e
-    typedef bool Value;
+    typedef MapBase<typename M::Key, bool, NC> Parent;
+    typedef typename Parent::Key Key;
+    typedef typename Parent::Value Value;
 
     ///Constructor
@@ -864,15 +852,8 @@
   ///This function just returns a \ref NotMap class.
   ///\relates NotMap
-  template<class M> 
-  inline NotMap<M> notMap(const M &m) 
-  {
-    return NotMap<M>(m);
-  }
-
-
-
-
-
-
+  template <typename M> 
+  inline NotMap<M, True> notMap(const M &m) {
+    return NotMap<M, True>(m);
+  }
 
 
Index: test/map_test.h
===================================================================
--- test/map_test.h	(revision 1435)
+++ test/map_test.h	(revision 1675)
@@ -50,4 +50,8 @@
       map[nodes.back()] = 23;
     }
+    map = constMap<Node>(12);
+    for (int i = 0; i < (int)nodes.size(); ++i) {
+      check(map[nodes[i]] == 12, "Wrong map constructor.");      
+    }    
     graph.clear();
     nodes.clear();
@@ -87,4 +91,8 @@
       }
     }
+    map = constMap<Edge>(12);
+    for (int i = 0; i < (int)edges.size(); ++i) {
+      check(map[edges[i]] == 12, "Wrong map constructor.");      
+    }    
     graph.clear();
     edges.clear();    
Index: test/maps_test.cc
===================================================================
--- test/maps_test.cc	(revision 1435)
+++ test/maps_test.cc	(revision 1675)
@@ -10,11 +10,16 @@
 struct A {};
 struct B {};
-class F
-{
+
+class F {
 public:
+  typedef A argument_type;
+  typedef B result_type;
+
   B operator()(const A &) const {return B();}
 };
 
 int func(A) {return 3;}
+
+int binc(int, B) {return 4;}
 
 typedef ReadMap<A,double> DoubleMap;
@@ -39,5 +44,5 @@
   checkConcept<ReadMap<B,double>, ComposeMap<DoubleMap,ReadMap<B,A> > >();
 
-  checkConcept<ReadMap<A,B>, FunctorMap<A,B,F> >();
+  checkConcept<ReadMap<A,B>, FunctorMap<F, A, B> >();
 
   int a;
@@ -47,8 +52,12 @@
 
   B b;
-  b=functorMap<A,B>(F())[A()];
+  b=functorMap(F())[A()];
 
-  a=functorMap<A,int>(&func)[A()];
+  a=functorMap(&func)[A()];
   check(a==3,"Something is wrong with functorMap");
+
+  a=combineMap(constMap<B, int, 1>(), identityMap<B>(), &binc)[B()];
+  check(a==4,"Something is wrong with combineMap");
+  
 
   std::cout << __FILE__ ": All tests passed.\n";
