Changeset 1317:83f80464f111 in lemon0.x for src/lemon
 Timestamp:
 04/07/05 13:30:12 (15 years ago)
 Branch:
 default
 Phase:
 public
 Convert:
 svn:c9d7d8f590d60310b91f818b3a526b0e/lemon/trunk@1756
 Location:
 src/lemon
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

src/lemon/maps.h
r1223 r1317 743 743 ///If \c M1 is also \ref concept::ReadMap "readable", 744 744 ///then the read operations will return the 745 ///corresponding values \c M1.745 ///corresponding values of \c M1. 746 746 /// 747 747 ///The \c Key and \c Value will be inherited from \c M1. 
src/lemon/xy.h
r1257 r1317 326 326 327 327 328 ///Map of xcoordinates of an xy<>map 329 330 ///\ingroup maps 331 /// 332 template<class M> 333 class XMap 334 { 335 M &_map; 336 public: 337 typedef typename M::Value::Value Value; 338 typedef typename M::Key Key; 339 ///\e 340 XMap(M &map) : _map(map) {} 341 Value operator[](Key k) const {return _map[k].x;} 342 Value set(Key k,Value v) {_map.set(k,typename M::Value(v,_map[k].y));} 343 }; 344 345 ///Returns an \ref XMap class 346 347 ///This function just returns an \ref XMap class. 348 /// 349 ///\ingroup maps 350 ///\relates XMap 351 template<class M> 352 inline XMap<M> xMap(M &m) 353 { 354 return XMap<M>(m); 355 } 356 357 ///Constant (read only) version of \ref XMap 358 359 ///\ingroup maps 360 /// 361 template<class M> 362 class ConstXMap 363 { 364 const M &_map; 365 public: 366 typedef typename M::Value::Value Value; 367 typedef typename M::Key Key; 368 ///\e 369 ConstXMap(const M &map) : _map(map) {} 370 Value operator[](Key k) const {return _map[k].x;} 371 }; 372 373 ///Returns a \ref ConstXMap class 374 375 ///This function just returns an \ref ConstXMap class. 376 /// 377 ///\ingroup maps 378 ///\relates ConstXMap 379 template<class M> 380 inline ConstXMap<M> xMap(const M &m) 381 { 382 return ConstXMap<M>(m); 383 } 384 385 ///Map of ycoordinates of an xy<>map 386 387 ///\ingroup maps 388 /// 389 template<class M> 390 class YMap 391 { 392 M &_map; 393 public: 394 typedef typename M::Value::Value Value; 395 typedef typename M::Key Key; 396 ///\e 397 YMap(M &map) : _map(map) {} 398 Value operator[](Key k) const {return _map[k].y;} 399 Value set(Key k,Value v) {_map.set(k,typename M::Value(_map[k].x,v));} 400 }; 401 402 ///Returns an \ref YMap class 403 404 ///This function just returns an \ref YMap class. 405 /// 406 ///\ingroup maps 407 ///\relates YMap 408 template<class M> 409 inline YMap<M> yMap(M &m) 410 { 411 return YMap<M>(m); 412 } 413 414 ///Constant (read only) version of \ref YMap 415 416 ///\ingroup maps 417 /// 418 template<class M> 419 class ConstYMap 420 { 421 const M &_map; 422 public: 423 typedef typename M::Value::Value Value; 424 typedef typename M::Key Key; 425 ///\e 426 ConstYMap(const M &map) : _map(map) {} 427 Value operator[](Key k) const {return _map[k].y;} 428 }; 429 430 ///Returns a \ref ConstYMap class 431 432 ///This function just returns an \ref ConstYMap class. 433 /// 434 ///\ingroup maps 435 ///\relates ConstYMap 436 template<class M> 437 inline ConstYMap<M> yMap(const M &m) 438 { 439 return ConstYMap<M>(m); 440 } 441 442 328 443 /// @} 329 444
Note: See TracChangeset
for help on using the changeset viewer.