Changeset 1691:6be54bcc14ec in lemon0.x
 Timestamp:
 09/30/05 15:12:39 (14 years ago)
 Branch:
 default
 Phase:
 public
 Convert:
 svn:c9d7d8f590d60310b91f818b3a526b0e/lemon/trunk@2217
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

lemon/maps.h
r1679 r1691 334 334 /// AddMap<X, ConstMap<X::Key, X::Value> > sh(x,v); 335 335 ///\endcode 336 template<typename M, typename NC = False>336 template<typename M, typename C = typename M::Value, typename NC = False> 337 337 class ShiftMap : public MapBase<typename M::Key, typename M::Value, NC> { 338 338 typename SmartConstReference<M>::Type m; 339 typename M::Valuev;339 C v; 340 340 public: 341 341 typedef MapBase<typename M::Key, typename M::Value, NC> Parent; … … 348 348 ///\param _m is the undelying map 349 349 ///\param _v is the shift value 350 ShiftMap(const M &_m, const Value&_v ) : m(_m), v(_v) {};351 Value operator[](Key k) const {return m[k] +v;}350 ShiftMap(const M &_m, const C &_v ) : m(_m), v(_v) {}; 351 Value operator[](Key k) const {return m[k] + v;} 352 352 }; 353 353 … … 357 357 ///\relates ShiftMap 358 358 ///\todo A better name is required. 359 template<typename M >360 inline ShiftMap<M, True> shiftMap(const M &m,const typename M::Value&v) {361 return ShiftMap<M, True>(m,v);359 template<typename M, typename C> 360 inline ShiftMap<M, C, True> shiftMap(const M &m,const C &v) { 361 return ShiftMap<M, C, True>(m,v); 362 362 } 363 363 … … 427 427 428 428 ///This \ref concept::ReadMap "read only map" returns the value of the 429 ///given map multiplied with a constant value.429 ///given map multiplied from the left side with a constant value. 430 430 ///Its \c Key and \c Value is inherited from \c M. 431 431 /// … … 439 439 /// MulMap<X, ConstMap<X::Key, X::Value> > sc(x,v); 440 440 ///\endcode 441 template<typename M, typename NC = False>441 template<typename M, typename C = typename M::Value, typename NC = False> 442 442 class ScaleMap : public MapBase<typename M::Key, typename M::Value, NC> { 443 443 typename SmartConstReference<M>::Type m; 444 typename M::Valuev;444 C v; 445 445 public: 446 446 typedef MapBase<typename M::Key, typename M::Value, NC> Parent; … … 453 453 ///\param _m is the undelying map 454 454 ///\param _v is the scaling value 455 ScaleMap(const M &_m, const Value&_v ) : m(_m), v(_v) {};456 Value operator[](Key k) const {return m[k]*v;}455 ScaleMap(const M &_m, const C &_v ) : m(_m), v(_v) {}; 456 Value operator[](Key k) const {return v * m[k];} 457 457 }; 458 458 … … 462 462 ///\relates ScaleMap 463 463 ///\todo A better name is required. 464 template<typename M >465 inline ScaleMap<M, True> scaleMap(const M &m,const typename M::Value&v) {466 return ScaleMap<M, True>(m,v);464 template<typename M, typename C> 465 inline ScaleMap<M, C, True> scaleMap(const M &m,const C &v) { 466 return ScaleMap<M, C, True>(m,v); 467 467 } 468 468 … … 858 858 } 859 859 860 861 862 863 864 860 /// @} 865 861 }
Note: See TracChangeset
for help on using the changeset viewer.