# Changeset 1691:6be54bcc14ec in lemon-0.x

Ignore:
Timestamp:
09/30/05 15:12:39 (15 years ago)
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2217
Message:

Handling C x A -> A multiplication

File:
1 edited

Unmodified
Added
Removed
• ## lemon/maps.h

 r1679 ///  AddMap > sh(x,v); ///\endcode template template class ShiftMap : public MapBase { typename SmartConstReference::Type m; typename M::Value v; C v; public: typedef MapBase Parent; ///\param _m is the undelying map ///\param _v is the shift value ShiftMap(const M &_m, const Value &_v ) : m(_m), v(_v) {}; Value operator[](Key k) const {return m[k]+v;} ShiftMap(const M &_m, const C &_v ) : m(_m), v(_v) {}; Value operator[](Key k) const {return m[k] + v;} }; ///\relates ShiftMap ///\todo A better name is required. template inline ShiftMap shiftMap(const M &m,const typename M::Value &v) { return ShiftMap(m,v); template inline ShiftMap shiftMap(const M &m,const C &v) { return ShiftMap(m,v); } ///This \ref concept::ReadMap "read only map" returns the value of the ///given map multiplied with a constant value. ///given map multiplied from the left side with a constant value. ///Its \c Key and \c Value is inherited from \c M. /// ///  MulMap > sc(x,v); ///\endcode template template class ScaleMap : public MapBase { typename SmartConstReference::Type m; typename M::Value v; C v; public: typedef MapBase Parent; ///\param _m is the undelying map ///\param _v is the scaling value ScaleMap(const M &_m,const Value &_v ) : m(_m), v(_v) {}; Value operator[](Key k) const {return m[k]*v;} ScaleMap(const M &_m, const C &_v ) : m(_m), v(_v) {}; Value operator[](Key k) const {return v * m[k];} }; ///\relates ScaleMap ///\todo A better name is required. template inline ScaleMap scaleMap(const M &m,const typename M::Value &v) { return ScaleMap(m,v); template inline ScaleMap scaleMap(const M &m,const C &v) { return ScaleMap(m,v); } } /// @} }
Note: See TracChangeset for help on using the changeset viewer.