Changeset 1352:bdbb9144a49e in lemon-0.x for src/lemon/xy.h
- Timestamp:
- 04/14/05 14:30:18 (19 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1796
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/lemon/xy.h
r1317 r1352 340 340 XMap(M &map) : _map(map) {} 341 341 Value operator[](Key k) const {return _map[k].x;} 342 Valueset(Key k,Value v) {_map.set(k,typename M::Value(v,_map[k].y));}342 void set(Key k,Value v) {_map.set(k,typename M::Value(v,_map[k].y));} 343 343 }; 344 344 … … 397 397 YMap(M &map) : _map(map) {} 398 398 Value operator[](Key k) const {return _map[k].y;} 399 Valueset(Key k,Value v) {_map.set(k,typename M::Value(_map[k].x,v));}399 void set(Key k,Value v) {_map.set(k,typename M::Value(_map[k].x,v));} 400 400 }; 401 401 … … 441 441 442 442 443 ///Map of the \ref xy::normSquare() "normSquare()" of an \ref xy "xy"-map 444 445 ///Map of the \ref xy::normSquare() "normSquare()" of an \ref xy "xy"-map 446 ///\ingroup maps 447 /// 448 template<class M> 449 class NormSquareMap 450 { 451 const M &_map; 452 public: 453 typedef typename M::Value::Value Value; 454 typedef typename M::Key Key; 455 ///\e 456 NormSquareMap(const M &map) : _map(map) {} 457 Value operator[](Key k) const {return _map[k].normSquare();} 458 }; 459 460 ///Returns a \ref NormSquareMap class 461 462 ///This function just returns an \ref NormSquareMap class. 463 /// 464 ///\ingroup maps 465 ///\relates NormSquareMap 466 template<class M> 467 inline NormSquareMap<M> normSquareMap(const M &m) 468 { 469 return NormSquareMap<M>(m); 470 } 471 443 472 /// @} 444 473
Note: See TracChangeset
for help on using the changeset viewer.