Index: lemon/maps.h
===================================================================
--- lemon/maps.h	(revision 1695)
+++ lemon/maps.h	(revision 1705)
@@ -39,9 +39,7 @@
   /// Base class of maps.
   /// It provides the necessary <tt>typedef</tt>s required by the map concept.
-  template<typename K, typename T, typename _NeedCopy = False>
+  template<typename K, typename T>
   class MapBase {
   public:
-    /// \e
-    typedef _NeedCopy NeedCopy;
     ///\e
     typedef K Key;
@@ -55,8 +53,8 @@
   /// 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, typename NC = False>
-  class NullMap : public MapBase<K, T, NC> {
-  public:
-    typedef MapBase<K, T, NC> Parent;
+  template<typename K, typename T>
+  class NullMap : public MapBase<K, T> {
+  public:
+    typedef MapBase<K, T> Parent;
     typedef typename Parent::Key Key;
     typedef typename Parent::Value Value;
@@ -69,6 +67,6 @@
 
   template <typename K, typename V> 
-  NullMap<K, V, True> nullMap() {
-    return NullMap<K, V, True>();
+  NullMap<K, V> nullMap() {
+    return NullMap<K, V>();
   }
 
@@ -79,11 +77,11 @@
   /// In other aspects it is equivalent to the \ref NullMap.
   /// \todo set could be used to set the value.
-  template<typename K, typename T, typename NC = False>
-  class ConstMap : public MapBase<K, T, NC> {
+  template<typename K, typename T>
+  class ConstMap : public MapBase<K, T> {
   private:
     T v;
   public:
 
-    typedef MapBase<K, T, NC> Parent;
+    typedef MapBase<K, T> Parent;
     typedef typename Parent::Key Key;
     typedef typename Parent::Value Value;
@@ -117,6 +115,6 @@
   ///\relates ConstMap
   template<typename K, typename V> 
-  inline ConstMap<K, V, True> constMap(const V &v) {
-    return ConstMap<K, V, True>(v);
+  inline ConstMap<K, V> constMap(const V &v) {
+    return ConstMap<K, V>(v);
   }
 
@@ -127,8 +125,8 @@
 
   //\todo to document later
-  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;
+  template<typename K, typename V, V v>
+  class ConstMap<K, Const<V, v> > : public MapBase<K, V> {
+  public:
+    typedef MapBase<K, V> Parent;
     typedef typename Parent::Key Key;
     typedef typename Parent::Value Value;
@@ -144,6 +142,6 @@
   ///\relates ConstMap
   template<typename K, typename V, V v> 
-  inline ConstMap<K, Const<V, v>, True> constMap() {
-    return ConstMap<K, Const<V, v>, True>();
+  inline ConstMap<K, Const<V, v> > constMap() {
+    return ConstMap<K, Const<V, v> >();
   }
 
@@ -226,8 +224,8 @@
   /// This mapping gives back the given key as value without any
   /// modification. 
-  template <typename T, typename NC = False>
-  class IdentityMap : public MapBase<T, T, NC> {
-  public:
-    typedef MapBase<T, T, NC> Parent;
+  template <typename T>
+  class IdentityMap : public MapBase<T, T> {
+  public:
+    typedef MapBase<T, T> Parent;
     typedef typename Parent::Key Key;
     typedef typename Parent::Value Value;
@@ -243,6 +241,6 @@
   ///\relates IdentityMap
   template<typename T>
-  inline IdentityMap<T, True> identityMap() {
-    return IdentityMap<T, True>();
+  inline IdentityMap<T> identityMap() {
+    return IdentityMap<T>();
   }
   
@@ -253,9 +251,9 @@
   ///converts the \c Value of a maps to type \c T.
   ///Its \c Key is inherited from \c M.
-  template <typename M, typename T, typename NC = False> 
-  class ConvertMap : public MapBase<typename M::Key, T, NC> {
-    typename SmartConstReference<M>::Type m;
-  public:
-    typedef MapBase<typename M::Key, T, NC> Parent;
+  template <typename M, typename T> 
+  class ConvertMap : public MapBase<typename M::Key, T> {
+    const M& m;
+  public:
+    typedef MapBase<typename M::Key, T> Parent;
     typedef typename Parent::Key Key;
     typedef typename Parent::Value Value;
@@ -281,6 +279,6 @@
   ///\todo The order of the template parameters are changed.
   template<typename T, typename M>
-  inline ConvertMap<M, T, True> convertMap(const M &m) {
-    return ConvertMap<M, T, True>(m);
+  inline ConvertMap<M, T> convertMap(const M &m) {
+    return ConvertMap<M, T>(m);
   }
 
@@ -291,11 +289,11 @@
   ///The \c Key and \c Value of M2 must be convertible to those of \c M1.
 
-  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 MapBase<typename M1::Key, typename M1::Value, NC> Parent;
+  template<typename M1, typename M2> 
+  class AddMap : public MapBase<typename M1::Key, typename M1::Value> {
+    const M1& m1;
+    const M2& m2;
+
+  public:
+    typedef MapBase<typename M1::Key, typename M1::Value> Parent;
     typedef typename Parent::Key Key;
     typedef typename Parent::Value Value;
@@ -314,6 +312,6 @@
   ///\todo Wrong scope in Doxygen when \c \\relates is used
   template<typename M1, typename M2> 
-  inline AddMap<M1, M2, True> addMap(const M1 &m1,const M2 &m2) {
-    return AddMap<M1, M2, True>(m1,m2);
+  inline AddMap<M1, M2> addMap(const M1 &m1,const M2 &m2) {
+    return AddMap<M1, M2>(m1,m2);
   }
 
@@ -333,10 +331,10 @@
   ///  AddMap<X, ConstMap<X::Key, X::Value> > sh(x,v);
   ///\endcode
-  template<typename M, typename C = typename M::Value, typename NC = False> 
-  class ShiftMap : public MapBase<typename M::Key, typename M::Value, NC> {
-    typename SmartConstReference<M>::Type m;
+  template<typename M, typename C = typename M::Value> 
+  class ShiftMap : public MapBase<typename M::Key, typename M::Value> {
+    const M& m;
     C v;
   public:
-    typedef MapBase<typename M::Key, typename M::Value, NC> Parent;
+    typedef MapBase<typename M::Key, typename M::Value> Parent;
     typedef typename Parent::Key Key;
     typedef typename Parent::Value Value;
@@ -357,6 +355,6 @@
   ///\todo A better name is required.
   template<typename M, typename C> 
-  inline ShiftMap<M, C, True> shiftMap(const M &m,const C &v) {
-    return ShiftMap<M, C, True>(m,v);
+  inline ShiftMap<M, C> shiftMap(const M &m,const C &v) {
+    return ShiftMap<M, C>(m,v);
   }
 
@@ -368,10 +366,10 @@
   ///The \c Key and \c Value of \c M2 must be convertible to those of \c M1.
 
-  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 MapBase<typename M1::Key, typename M1::Value, NC> Parent;
+  template<typename M1, typename M2> 
+  class SubMap : public MapBase<typename M1::Key, typename M1::Value> {
+    const M1& m1;
+    const M2& m2;
+  public:
+    typedef MapBase<typename M1::Key, typename M1::Value> Parent;
     typedef typename Parent::Key Key;
     typedef typename Parent::Value Value;
@@ -388,6 +386,6 @@
   ///\relates SubMap
   template<typename M1, typename M2> 
-  inline SubMap<M1, M2, True> subMap(const M1 &m1, const M2 &m2) {
-    return SubMap<M1, M2, True>(m1, m2);
+  inline SubMap<M1, M2> subMap(const M1 &m1, const M2 &m2) {
+    return SubMap<M1, M2>(m1, m2);
   }
 
@@ -400,10 +398,10 @@
   ///The \c Key and \c Value of \c M2 must be convertible to those of \c M1.
 
-  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 MapBase<typename M1::Key, typename M1::Value, NC> Parent;
+  template<typename M1, typename M2> 
+  class MulMap : public MapBase<typename M1::Key, typename M1::Value> {
+    const M1& m1;
+    const M2& m2;
+  public:
+    typedef MapBase<typename M1::Key, typename M1::Value> Parent;
     typedef typename Parent::Key Key;
     typedef typename Parent::Value Value;
@@ -419,6 +417,6 @@
   ///\relates MulMap
   template<typename M1, typename M2> 
-  inline MulMap<M1, M2, True> mulMap(const M1 &m1,const M2 &m2) {
-    return MulMap<M1, M2, True>(m1,m2);
+  inline MulMap<M1, M2> mulMap(const M1 &m1,const M2 &m2) {
+    return MulMap<M1, M2>(m1,m2);
   }
  
@@ -438,10 +436,10 @@
   ///  MulMap<X, ConstMap<X::Key, X::Value> > sc(x,v);
   ///\endcode
-  template<typename M, typename C = typename M::Value, typename NC = False> 
-  class ScaleMap : public MapBase<typename M::Key, typename M::Value, NC> {
-    typename SmartConstReference<M>::Type m;
+  template<typename M, typename C = typename M::Value> 
+  class ScaleMap : public MapBase<typename M::Key, typename M::Value> {
+    const M& m;
     C v;
   public:
-    typedef MapBase<typename M::Key, typename M::Value, NC> Parent;
+    typedef MapBase<typename M::Key, typename M::Value> Parent;
     typedef typename Parent::Key Key;
     typedef typename Parent::Value Value;
@@ -462,6 +460,6 @@
   ///\todo A better name is required.
   template<typename M, typename C> 
-  inline ScaleMap<M, C, True> scaleMap(const M &m,const C &v) {
-    return ScaleMap<M, C, True>(m,v);
+  inline ScaleMap<M, C> scaleMap(const M &m,const C &v) {
+    return ScaleMap<M, C>(m,v);
   }
 
@@ -473,10 +471,10 @@
   ///The \c Key and \c Value of \c M2 must be convertible to those of \c M1.
 
-  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 MapBase<typename M1::Key, typename M1::Value, NC> Parent;
+  template<typename M1, typename M2> 
+  class DivMap : public MapBase<typename M1::Key, typename M1::Value> {
+    const M1& m1;
+    const M2& m2;
+  public:
+    typedef MapBase<typename M1::Key, typename M1::Value> Parent;
     typedef typename Parent::Key Key;
     typedef typename Parent::Value Value;
@@ -492,6 +490,6 @@
   ///\relates DivMap
   template<typename M1, typename M2> 
-  inline DivMap<M1, M2, True> divMap(const M1 &m1,const M2 &m2) {
-    return DivMap<M1, M2, True>(m1,m2);
+  inline DivMap<M1, M2> divMap(const M1 &m1,const M2 &m2) {
+    return DivMap<M1, M2>(m1,m2);
   }
   
@@ -513,10 +511,10 @@
   ///\todo Check the requirements.
 
-  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 MapBase<typename M2::Key, typename M1::Value, NC> Parent;
+  template <typename M1, typename M2> 
+  class ComposeMap : public MapBase<typename M2::Key, typename M1::Value> {
+    const M1& m1;
+    const M2& m2;
+  public:
+    typedef MapBase<typename M2::Key, typename M1::Value> Parent;
     typedef typename Parent::Key Key;
     typedef typename Parent::Value Value;
@@ -532,6 +530,6 @@
   ///\relates ComposeMap
   template <typename M1, typename M2> 
-  inline ComposeMap<M1, M2, True> composeMap(const M1 &m1,const M2 &m2) {
-    return ComposeMap<M1, M2, True>(m1,m2);
+  inline ComposeMap<M1, M2> composeMap(const M1 &m1,const M2 &m2) {
+    return ComposeMap<M1, M2>(m1,m2);
   }
   
@@ -562,10 +560,10 @@
 	   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;
+  class CombineMap : public MapBase<typename M1::Key, V> {
+    const M1& m1;
+    const M2& m2;
     F f;
   public:
-    typedef MapBase<typename M1::Key, V, NC> Parent;
+    typedef MapBase<typename M1::Key, V> Parent;
     typedef typename Parent::Key Key;
     typedef typename Parent::Value Value;
@@ -594,11 +592,11 @@
   ///\relates CombineMap
   template<typename M1, typename M2, typename F, typename V> 
-  inline CombineMap<M1, M2, F, V, True> 
+  inline CombineMap<M1, M2, F, V> 
   combineMap(const M1& m1,const M2& m2, const F& f) {
-    return CombineMap<M1, M2, F, V, True>(m1,m2,f);
+    return CombineMap<M1, M2, F, V>(m1,m2,f);
   }
 
   template<typename M1, typename M2, typename F> 
-  inline CombineMap<M1, M2, F, typename F::result_type, True> 
+  inline CombineMap<M1, M2, F, typename F::result_type> 
   combineMap(const M1& m1, const M2& m2, const F& f) {
     return combineMap<M1, M2, F, typename F::result_type>(m1,m2,f);
@@ -606,5 +604,5 @@
 
   template<typename M1, typename M2, typename K1, typename K2, typename V> 
-  inline CombineMap<M1, M2, V (*)(K1, K2), V, True> 
+  inline CombineMap<M1, M2, V (*)(K1, K2), V> 
   combineMap(const M1 &m1, const M2 &m2, V (*f)(K1, K2)) {
     return combineMap<M1, M2, V (*)(K1, K2), V>(m1,m2,f);
@@ -619,9 +617,9 @@
   ///The unary \c - operator must be defined for \c Value, of course.
 
-  template<typename M, typename NC = False> 
-  class NegMap : public MapBase<typename M::Key, typename M::Value, NC> {
-    typename SmartConstReference<M>::Type m;
-  public:
-    typedef MapBase<typename M::Key, typename M::Value, NC> Parent;
+  template<typename M> 
+  class NegMap : public MapBase<typename M::Key, typename M::Value> {
+    const M& m;
+  public:
+    typedef MapBase<typename M::Key, typename M::Value> Parent;
     typedef typename Parent::Key Key;
     typedef typename Parent::Value Value;
@@ -637,6 +635,6 @@
   ///\relates NegMap
   template <typename M> 
-  inline NegMap<M, True> negMap(const M &m) {
-    return NegMap<M, True>(m);
+  inline NegMap<M> negMap(const M &m) {
+    return NegMap<M>(m);
   }
 
@@ -665,9 +663,9 @@
   
 
-  template<typename M, typename NC = False> 
-  class AbsMap : public MapBase<typename M::Key, typename M::Value, NC> {
-    typename SmartConstReference<M>::Type m;
-  public:
-    typedef MapBase<typename M::Key, typename M::Value, NC> Parent;
+  template<typename M> 
+  class AbsMap : public MapBase<typename M::Key, typename M::Value> {
+    const M& m;
+  public:
+    typedef MapBase<typename M::Key, typename M::Value> Parent;
     typedef typename Parent::Key Key;
     typedef typename Parent::Value Value;
@@ -687,6 +685,6 @@
   ///\relates AbsMap
   template<typename M> 
-  inline AbsMap<M, True> absMap(const M &m) {
-    return AbsMap<M, True>(m);
+  inline AbsMap<M> absMap(const M &m) {
+    return AbsMap<M>(m);
   }
 
@@ -708,8 +706,8 @@
 	   typename V = typename F::result_type,
 	   typename NC = False> 
-  class FunctorMap : public MapBase<K, V, NC> {
+  class FunctorMap : public MapBase<K, V> {
     F f;
   public:
-    typedef MapBase<K, V, NC> Parent;
+    typedef MapBase<K, V> Parent;
     typedef typename Parent::Key Key;
     typedef typename Parent::Value Value;
@@ -728,18 +726,18 @@
   ///\relates FunctorMap
   template<typename K, typename V, typename F> inline 
-  FunctorMap<F, K, V, True> functorMap(const F &f) {
-    return FunctorMap<F, K, V, True>(f);
+  FunctorMap<F, K, V> functorMap(const F &f) {
+    return FunctorMap<F, K, V>(f);
   }
 
   template <typename F> inline 
-  FunctorMap<F, typename F::argument_type, typename F::result_type, True> 
+  FunctorMap<F, typename F::argument_type, typename F::result_type> 
   functorMap(const F &f) {
     return FunctorMap<F, typename F::argument_type, 
-      typename F::result_type, True>(f);
+      typename F::result_type>(f);
   }
 
   template <typename K, typename V> inline 
-  FunctorMap<V (*)(K), K, V, True> functorMap(V (*f)(K)) {
-    return FunctorMap<V (*)(K), K, V, True>(f);
+  FunctorMap<V (*)(K), K, V> functorMap(V (*f)(K)) {
+    return FunctorMap<V (*)(K), K, V>(f);
   }
 
@@ -754,9 +752,9 @@
   ///i.e. <tt>operator[]</tt> and the \c Key and \c Value typedefs also exist.
 
-  template <typename M, typename NC = False> 
-  class MapFunctor : public MapBase<typename M::Key, typename M::Value, NC> {
-    typename SmartConstReference<M>::Type m;
-  public:
-    typedef MapBase<typename M::Key, typename M::Value, NC> Parent;
+  template <typename M> 
+  class MapFunctor : public MapBase<typename M::Key, typename M::Value> {
+    const M& m;
+  public:
+    typedef MapBase<typename M::Key, typename M::Value> Parent;
     typedef typename Parent::Key Key;
     typedef typename Parent::Value Value;
@@ -780,6 +778,6 @@
   ///\relates MapFunctor
   template<typename M> 
-  inline MapFunctor<M, True> mapFunctor(const M &m) {
-    return MapFunctor<M, True>(m);
+  inline MapFunctor<M> mapFunctor(const M &m) {
+    return MapFunctor<M>(m);
   }
 
@@ -796,10 +794,10 @@
   ///The \c Key and \c Value of M2 must be convertible from those of \c M1.
 
-  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 MapBase<typename M1::Key, typename M1::Value, NC> Parent;
+  template<typename  M1, typename M2> 
+  class ForkMap : public MapBase<typename M1::Key, typename M1::Value> {
+    const M1& m1;
+    const M2& m2;
+  public:
+    typedef MapBase<typename M1::Key, typename M1::Value> Parent;
     typedef typename Parent::Key Key;
     typedef typename Parent::Value Value;
@@ -819,6 +817,6 @@
   ///\todo Wrong scope in Doxygen when \c \\relates is used
   template <typename M1, typename M2> 
-  inline ForkMap<M1, M2, True> forkMap(const M1 &m1,const M2 &m2) {
-    return ForkMap<M1, M2, True>(m1,m2);
+  inline ForkMap<M1, M2> forkMap(const M1 &m1,const M2 &m2) {
+    return ForkMap<M1, M2>(m1,m2);
   }
 
@@ -835,9 +833,9 @@
   ///its Value is <tt>bool</tt>.
 
-  template <typename M, typename NC = False> 
-  class NotMap : public MapBase<typename M::Key, bool, NC> {
-    typename SmartConstReference<M>::Type m;
-  public:
-    typedef MapBase<typename M::Key, bool, NC> Parent;
+  template <typename M> 
+  class NotMap : public MapBase<typename M::Key, bool> {
+    const M& m;
+  public:
+    typedef MapBase<typename M::Key, bool> Parent;
     typedef typename Parent::Key Key;
     typedef typename Parent::Value Value;
@@ -853,6 +851,6 @@
   ///\relates NotMap
   template <typename M> 
-  inline NotMap<M, True> notMap(const M &m) {
-    return NotMap<M, True>(m);
+  inline NotMap<M> notMap(const M &m) {
+    return NotMap<M>(m);
   }
 
