Changeset 1420:e37cca875667 in lemon0.x
 Timestamp:
 05/14/05 19:37:33 (16 years ago)
 Branch:
 default
 Phase:
 public
 Convert:
 svn:c9d7d8f590d60310b91f818b3a526b0e/lemon/trunk@1890
 Location:
 src/lemon
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

src/lemon/maps.h
r1402 r1420 18 18 #define LEMON_MAPS_H 19 19 20 #include <lemon/graph_utils.h> 21 #include <lemon/utility.h> 22 20 23 21 24 ///\file … … 56 59 { 57 60 public: 61 62 typedef True NeedCopy; 58 63 59 64 /// Gives back a default constructed element. … … 62 67 void set(const K&, const T&) {} 63 68 }; 69 70 template <typename K, typename V> 71 NullMap<K, V> nullMap() { 72 return NullMap<K, V>(); 73 } 64 74 65 75 … … 74 84 T v; 75 85 public: 86 87 typedef True NeedCopy; 76 88 77 89 /// Default constructor … … 209 221 ///\bug wrong documentation 210 222 template<class M, class T> 211 class ConvertMap 212 { 213 const M &m; 214 public: 223 class ConvertMap { 224 typename SmartConstReference<M>::Type m; 225 public: 226 227 typedef True NeedCopy; 228 215 229 typedef typename M::Key Key; 216 230 typedef T Value; … … 251 265 class AddMap 252 266 { 253 const M1 &m1; 254 const M2 &m2; 255 public: 267 typename SmartConstReference<M1>::Type m1; 268 typename SmartConstReference<M2>::Type m2; 269 270 public: 271 272 typedef True NeedCopy; 273 256 274 typedef typename M1::Key Key; 257 275 typedef typename M1::Value Value; … … 296 314 class ShiftMap 297 315 { 298 const M &m;316 typename SmartConstReference<M>::Type m; 299 317 typename M::Value v; 300 318 public: 319 320 typedef True NeedCopy; 301 321 typedef typename M::Key Key; 302 322 typedef typename M::Value Value; … … 332 352 class SubMap 333 353 { 334 const M1 &m1; 335 const M2 &m2; 336 public: 354 typename SmartConstReference<M1>::Type m1; 355 typename SmartConstReference<M2>::Type m2; 356 public: 357 358 typedef True NeedCopy; 337 359 typedef typename M1::Key Key; 338 360 typedef typename M1::Value Value; … … 368 390 class MulMap 369 391 { 370 const M1 &m1; 371 const M2 &m2; 372 public: 392 typename SmartConstReference<M1>::Type m1; 393 typename SmartConstReference<M2>::Type m2; 394 public: 395 396 typedef True NeedCopy; 373 397 typedef typename M1::Key Key; 374 398 typedef typename M1::Value Value; … … 410 434 class ScaleMap 411 435 { 412 const M &m;436 typename SmartConstReference<M>::Type m; 413 437 typename M::Value v; 414 438 public: 439 440 typedef True NeedCopy; 415 441 typedef typename M::Key Key; 416 442 typedef typename M::Value Value; … … 446 472 class DivMap 447 473 { 448 const M1 &m1; 449 const M2 &m2; 450 public: 474 typename SmartConstReference<M1>::Type m1; 475 typename SmartConstReference<M2>::Type m2; 476 public: 477 478 typedef True NeedCopy; 451 479 typedef typename M1::Key Key; 452 480 typedef typename M1::Value Value; … … 490 518 class ComposeMap 491 519 { 492 const M1 &m1; 493 const M2 &m2; 494 public: 520 typename SmartConstReference<M1>::Type m1; 521 typename SmartConstReference<M2>::Type m2; 522 public: 523 524 typedef True NeedCopy; 495 525 typedef typename M2::Key Key; 496 526 typedef typename M1::Value Value; 527 528 typedef True NeedCopy; 497 529 498 530 ///Constructor … … 537 569 ///\todo Check the requirements. 538 570 539 template<class M1,class M2,class F,class V >571 template<class M1,class M2,class F,class V = typename F::result_type> 540 572 class CombineMap 541 573 { 542 const M1 &m1; 543 const M2 &m2; 544 const F &f; 545 public: 574 typename SmartConstReference<M1>::Type m1; 575 typename SmartConstReference<M2>::Type m2; 576 F f; 577 public: 578 579 typedef True NeedCopy; 546 580 typedef typename M1::Key Key; 547 581 typedef V Value; … … 572 606 /// 573 607 ///\relates CombineMap 574 template<class V,classM1,class M2,class F>575 inline CombineMap<M1,M2,F ,V> combineMap(const M1 &m1,const M2 &m2,const F &f)576 { 577 return CombineMap<M1,M2,F ,V>(m1,m2,f);608 template<class M1,class M2,class F> 609 inline CombineMap<M1,M2,F> combineMap(const M1 &m1,const M2 &m2,const F &f) 610 { 611 return CombineMap<M1,M2,F>(m1,m2,f); 578 612 } 579 613 … … 589 623 class NegMap 590 624 { 591 const M &m; 592 public: 625 typename SmartConstReference<M>::Type m; 626 public: 627 628 typedef True NeedCopy; 593 629 typedef typename M::Key Key; 594 630 typedef typename M::Value Value; … … 639 675 class AbsMap 640 676 { 641 const M &m; 642 public: 677 typename SmartConstReference<M>::Type m; 678 public: 679 680 typedef True NeedCopy; 643 681 typedef typename M::Key Key; 644 682 typedef typename M::Value Value; … … 680 718 const F &f; 681 719 public: 720 721 typedef True NeedCopy; 682 722 typedef K Key; 683 723 typedef V Value; … … 715 755 class MapFunctor 716 756 { 717 const M &m; 718 public: 757 typename SmartConstReference<M>::Type m; 758 public: 759 760 typedef True NeedCopy; 719 761 typedef typename M::Key argument_type; 720 762 typedef typename M::Value result_type; … … 762 804 class ForkMap 763 805 { 764 const M1 &m1; 765 const M2 &m2; 766 public: 806 typename SmartConstReference<M1>::Type m1; 807 typename SmartConstReference<M2>::Type m2; 808 public: 809 810 typedef True NeedCopy; 767 811 typedef typename M1::Key Key; 768 812 typedef typename M1::Value Value; 
src/lemon/xy.h
r1392 r1420 19 19 20 20 #include <iostream> 21 #include <lemon/utility.h> 21 22 22 23 ///\ingroup misc … … 351 352 class XMap 352 353 { 353 M &_map;354 typename SmartReference<M>::Type _map; 354 355 public: 356 typedef True NeedCopy; 357 355 358 typedef typename M::Value::Value Value; 356 359 typedef typename M::Key Key; 357 360 ///\e 358 XMap( M &map) : _map(map) {}361 XMap(typename SmartParameter<M>::Type map) : _map(map) {} 359 362 Value operator[](Key k) const {return _map[k].x;} 360 363 void set(Key k,Value v) {_map.set(k,typename M::Value(v,_map[k].y));} … … 373 376 } 374 377 378 template<class M> 379 inline XMap<M> xMap(const M &m) 380 { 381 return XMap<M>(m); 382 } 383 375 384 ///Constant (read only) version of \ref XMap 376 385 … … 380 389 class ConstXMap 381 390 { 382 const M &_map;391 typename SmartConstReference<M>::Type _map; 383 392 public: 393 typedef True NeedCopy; 394 384 395 typedef typename M::Value::Value Value; 385 396 typedef typename M::Key Key; … … 408 419 class YMap 409 420 { 410 M &_map;421 typename SmartReference<M>::Type _map; 411 422 public: 423 typedef True NeedCopy; 424 412 425 typedef typename M::Value::Value Value; 413 426 typedef typename M::Key Key; 414 427 ///\e 415 YMap( M &map) : _map(map) {}428 YMap(typename SmartParameter<M>::Type map) : _map(map) {} 416 429 Value operator[](Key k) const {return _map[k].y;} 417 430 void set(Key k,Value v) {_map.set(k,typename M::Value(_map[k].x,v));} … … 430 443 } 431 444 445 template<class M> 446 inline YMap<M> yMap(const M &m) 447 { 448 return YMap<M>(m); 449 } 450 432 451 ///Constant (read only) version of \ref YMap 433 452 … … 437 456 class ConstYMap 438 457 { 439 const M &_map;458 typename SmartConstReference<M>::Type _map; 440 459 public: 460 typedef True NeedCopy; 461 441 462 typedef typename M::Value::Value Value; 442 463 typedef typename M::Key Key; … … 467 488 class NormSquareMap 468 489 { 469 const M &_map;490 typename SmartConstReference<M>::Type _map; 470 491 public: 492 typedef True NeedCopy; 493 471 494 typedef typename M::Value::Value Value; 472 495 typedef typename M::Key Key;
Note: See TracChangeset
for help on using the changeset viewer.