Changeset 1420:e37cca875667 in lemon-0.x for src/lemon/maps.h
- Timestamp:
- 05/14/05 19:37:33 (19 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1890
- File:
-
- 1 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;
Note: See TracChangeset
for help on using the changeset viewer.