1.1 --- a/lemon/maps.h Fri Sep 30 13:10:42 2005 +0000
1.2 +++ b/lemon/maps.h Fri Sep 30 13:12:39 2005 +0000
1.3 @@ -333,10 +333,10 @@
1.4 /// ConstMap<X::Key, X::Value> c_tmp(v);
1.5 /// AddMap<X, ConstMap<X::Key, X::Value> > sh(x,v);
1.6 ///\endcode
1.7 - template<typename M, typename NC = False>
1.8 + template<typename M, typename C = typename M::Value, typename NC = False>
1.9 class ShiftMap : public MapBase<typename M::Key, typename M::Value, NC> {
1.10 typename SmartConstReference<M>::Type m;
1.11 - typename M::Value v;
1.12 + C v;
1.13 public:
1.14 typedef MapBase<typename M::Key, typename M::Value, NC> Parent;
1.15 typedef typename Parent::Key Key;
1.16 @@ -347,8 +347,8 @@
1.17 ///Constructor
1.18 ///\param _m is the undelying map
1.19 ///\param _v is the shift value
1.20 - ShiftMap(const M &_m, const Value &_v ) : m(_m), v(_v) {};
1.21 - Value operator[](Key k) const {return m[k]+v;}
1.22 + ShiftMap(const M &_m, const C &_v ) : m(_m), v(_v) {};
1.23 + Value operator[](Key k) const {return m[k] + v;}
1.24 };
1.25
1.26 ///Returns an \ref ShiftMap class
1.27 @@ -356,9 +356,9 @@
1.28 ///This function just returns an \ref ShiftMap class.
1.29 ///\relates ShiftMap
1.30 ///\todo A better name is required.
1.31 - template<typename M>
1.32 - inline ShiftMap<M, True> shiftMap(const M &m,const typename M::Value &v) {
1.33 - return ShiftMap<M, True>(m,v);
1.34 + template<typename M, typename C>
1.35 + inline ShiftMap<M, C, True> shiftMap(const M &m,const C &v) {
1.36 + return ShiftMap<M, C, True>(m,v);
1.37 }
1.38
1.39 ///Difference of two maps
1.40 @@ -426,7 +426,7 @@
1.41 ///Scales a maps with a constant.
1.42
1.43 ///This \ref concept::ReadMap "read only map" returns the value of the
1.44 - ///given map multiplied with a constant value.
1.45 + ///given map multiplied from the left side with a constant value.
1.46 ///Its \c Key and \c Value is inherited from \c M.
1.47 ///
1.48 ///Actually,
1.49 @@ -438,10 +438,10 @@
1.50 /// ConstMap<X::Key, X::Value> c_tmp(v);
1.51 /// MulMap<X, ConstMap<X::Key, X::Value> > sc(x,v);
1.52 ///\endcode
1.53 - template<typename M, typename NC = False>
1.54 + template<typename M, typename C = typename M::Value, typename NC = False>
1.55 class ScaleMap : public MapBase<typename M::Key, typename M::Value, NC> {
1.56 typename SmartConstReference<M>::Type m;
1.57 - typename M::Value v;
1.58 + C v;
1.59 public:
1.60 typedef MapBase<typename M::Key, typename M::Value, NC> Parent;
1.61 typedef typename Parent::Key Key;
1.62 @@ -452,8 +452,8 @@
1.63 ///Constructor
1.64 ///\param _m is the undelying map
1.65 ///\param _v is the scaling value
1.66 - ScaleMap(const M &_m,const Value &_v ) : m(_m), v(_v) {};
1.67 - Value operator[](Key k) const {return m[k]*v;}
1.68 + ScaleMap(const M &_m, const C &_v ) : m(_m), v(_v) {};
1.69 + Value operator[](Key k) const {return v * m[k];}
1.70 };
1.71
1.72 ///Returns an \ref ScaleMap class
1.73 @@ -461,9 +461,9 @@
1.74 ///This function just returns an \ref ScaleMap class.
1.75 ///\relates ScaleMap
1.76 ///\todo A better name is required.
1.77 - template<typename M>
1.78 - inline ScaleMap<M, True> scaleMap(const M &m,const typename M::Value &v) {
1.79 - return ScaleMap<M, True>(m,v);
1.80 + template<typename M, typename C>
1.81 + inline ScaleMap<M, C, True> scaleMap(const M &m,const C &v) {
1.82 + return ScaleMap<M, C, True>(m,v);
1.83 }
1.84
1.85 ///Quotient of two maps
1.86 @@ -857,10 +857,6 @@
1.87 return NotMap<M, True>(m);
1.88 }
1.89
1.90 -
1.91 -
1.92 -
1.93 -
1.94 /// @}
1.95 }
1.96