Changeset 2489:48dddc283cfc in lemon-0.x for lemon
- Timestamp:
- 10/09/07 17:46:12 (17 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@3328
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/maps.h
r2423 r2489 30 30 ///\brief Miscellaneous property maps 31 31 /// 32 ///\todo This file has the same name as the concept file in concepts/,33 /// and this is not easily detectable in docs...34 35 32 #include <map> 36 33 … … 80 77 81 78 /// This is a readable map which assigns a specified value to each key. 82 /// In other aspects it is equivalent to the \ref NullMap. 83 /// \todo set could be used to set the value. 79 /// In other aspects it is equivalent to the \c NullMap. 84 80 template<typename K, typename T> 85 81 class ConstMap : public MapBase<K, T> { … … 102 98 /// 103 99 ConstMap(const T &_v) : v(_v) {} 104 100 101 ///\e 105 102 T operator[](const K&) const { return v; } 106 void set(const K&, const T&) {} 103 104 ///\e 105 void setAll(const T &t) { 106 v = t; 107 } 107 108 108 109 template<typename T1> … … 115 116 }; 116 117 117 ///Returns a \ refConstMap class118 119 ///This function just returns a \ refConstMap class.118 ///Returns a \c ConstMap class 119 120 ///This function just returns a \c ConstMap class. 120 121 ///\relates ConstMap 121 122 template<typename K, typename V> … … 125 126 126 127 127 //\todo to document later128 128 template<typename T, T v> 129 129 struct Const { }; 130 130 131 //\todo to document later 131 /// Constant map with inlined constant value. 132 133 /// This is a readable map which assigns a specified value to each key. 134 /// In other aspects it is equivalent to the \c NullMap. 132 135 template<typename K, typename V, V v> 133 136 class ConstMap<K, Const<V, v> > : public MapBase<K, V> { … … 138 141 139 142 ConstMap() { } 143 ///\e 140 144 V operator[](const K&) const { return v; } 145 ///\e 141 146 void set(const K&, const V&) { } 142 147 }; 143 148 144 ///Returns a \ refConstMap class145 146 ///This function just returns a \ ref ConstMap class.149 ///Returns a \c ConstMap class 150 151 ///This function just returns a \c ConstMap class with inlined value. 147 152 ///\relates ConstMap 148 153 template<typename K, typename V, V v> … … 151 156 } 152 157 153 /// \c std::map wrapper 154 155 /// This is essentially a wrapper for \c std::map. With addition that 156 /// you can specify a default value different from \c Value() . 157 /// 158 /// \todo Provide allocator parameter... 158 ///Map based on std::map 159 160 ///This is essentially a wrapper for \c std::map. With addition that 161 ///you can specify a default value different from \c Value() . 159 162 template <typename K, typename T, typename Compare = std::less<K> > 160 class StdMap : public std::map<K, T, Compare>{161 t ypedef std::map<K, T, Compare> parent;162 T v;163 typedef typename parent::value_type PairType;164 165 public:163 class StdMap { 164 template <typename K1, typename T1, typename C1> 165 friend class StdMap; 166 public: 167 168 typedef True ReferenceMapTag; 166 169 ///\e 167 170 typedef K Key; … … 173 176 typedef const T& ConstReference; 174 177 175 176 StdMap() : v() {} 178 private: 179 180 typedef std::map<K, T, Compare> Map; 181 Value _value; 182 Map _map; 183 184 public: 185 177 186 /// Constructor with specified default value 178 StdMap(const T& _v) : v(_v) {} 179 180 /// \brief Constructs the map from an appropriate std::map. 181 /// 182 /// \warning Inefficient: copies the content of \c m ! 183 StdMap(const parent &m) : parent(m) {} 187 StdMap(const T& value = T()) : _value(value) {} 184 188 /// \brief Constructs the map from an appropriate std::map, and explicitly 185 189 /// specifies a default value. 186 ///187 /// \warning Inefficient: copies the content of \c m !188 StdMap(const parent &m, const T& _v) : parent(m), v(_v) {}190 template <typename T1, typename Comp1> 191 StdMap(const std::map<Key, T1, Comp1> &map, const T& value = T()) 192 : _map(map.begin(), map.end()), _value(value) {} 189 193 194 /// \brief Constructs a map from an other StdMap. 190 195 template<typename T1, typename Comp1> 191 StdMap(const StdMap<Key, T1,Comp1> &m, const T &_v) { 192 //FIXME; 196 StdMap(const StdMap<Key, T1, Comp1> &c) 197 : _map(c._map.begin(), c._map.end()), _value(c._value) {} 198 199 private: 200 201 StdMap& operator=(const StdMap&); 202 203 public: 204 205 ///\e 206 Reference operator[](const Key &k) { 207 typename Map::iterator it = _map.lower_bound(k); 208 if (it != _map.end() && !_map.key_comp()(k, it->first)) 209 return it->second; 210 else 211 return _map.insert(it, std::make_pair(k, _value))->second; 193 212 } 194 213 195 Reference operator[](const Key &k) { 196 return insert(PairType(k,v)).first -> second; 214 /// \e 215 ConstReference operator[](const Key &k) const { 216 typename Map::const_iterator it = _map.find(k); 217 if (it != _map.end()) 218 return it->second; 219 else 220 return _value; 197 221 } 198 222 199 ConstReference operator[](const Key &k) const { 200 typename parent::iterator i = lower_bound(k); 201 if (i == parent::end() || parent::key_comp()(k, (*i).first)) 202 return v; 203 return (*i).second; 223 /// \e 224 void set(const Key &k, const T &t) { 225 typename Map::iterator it = _map.lower_bound(k); 226 if (it != _map.end() && !_map.key_comp()(k, it->first)) 227 it->second = t; 228 else 229 _map.insert(it, std::make_pair(k, t)); 204 230 } 205 void set(const Key &k, const T &t) { 206 parent::operator[](k) = t; 207 } 208 209 /// Changes the default value of the map. 210 /// \return Returns the previous default value. 211 /// 212 /// \warning The value of some keys (which has already been queried, but 213 /// the value has been unchanged from the default) may change! 214 T setDefault(const T &_v) { T old=v; v=_v; return old; } 215 216 template<typename T1> 231 232 /// \e 233 void setAll(const T &t) { 234 _value = t; 235 _map.clear(); 236 } 237 238 template <typename T1, typename C1 = std::less<T1> > 217 239 struct rebind { 218 typedef StdMap<Key, T1, Compare> other;240 typedef StdMap<Key, T1, C1> other; 219 241 }; 220 242 }; … … 236 258 typedef typename Parent::Value Value; 237 259 260 /// \e 238 261 const T& operator[](const T& t) const { 239 262 return t; … … 241 264 }; 242 265 243 ///Returns an \ refIdentityMap class244 245 ///This function just returns an \ refIdentityMap class.266 ///Returns an \c IdentityMap class 267 268 ///This function just returns an \c IdentityMap class. 246 269 ///\relates IdentityMap 247 270 template<typename T> … … 253 276 ///Convert the \c Value of a map to another type. 254 277 255 ///This \ refconcepts::ReadMap "read only map"278 ///This \c concepts::ReadMap "read only map" 256 279 ///converts the \c Value of a maps to type \c T. 257 280 ///Its \c Key is inherited from \c M. … … 278 301 }; 279 302 280 ///Returns an \ refConvertMap class281 282 ///This function just returns an \ refConvertMap class.303 ///Returns an \c ConvertMap class 304 305 ///This function just returns an \c ConvertMap class. 283 306 ///\relates ConvertMap 284 ///\todo The order of the template parameters are changed.285 307 template<typename T, typename M> 286 308 inline ConvertMap<M, T> convertMap(const M &m) { … … 290 312 ///Simple wrapping of the map 291 313 292 ///This \ refconcepts::ReadMap "read only map" returns the simple314 ///This \c concepts::ReadMap "read only map" returns the simple 293 315 ///wrapping of the given map. Sometimes the reference maps cannot be 294 316 ///combined with simple read maps. This map adaptor wraps the given … … 305 327 ///Constructor 306 328 SimpleMap(const M &_m) : m(_m) {}; 329 ///\e 307 330 Value operator[](Key k) const {return m[k];} 308 331 }; … … 310 333 ///Simple writeable wrapping of the map 311 334 312 ///This \ refconcepts::ReadMap "read only map" returns the simple335 ///This \c concepts::ReadMap "read only map" returns the simple 313 336 ///wrapping of the given map. Sometimes the reference maps cannot be 314 337 ///combined with simple read-write maps. This map adaptor wraps the … … 325 348 ///Constructor 326 349 SimpleWriteMap(M &_m) : m(_m) {}; 350 ///\e 327 351 Value operator[](Key k) const {return m[k];} 352 ///\e 328 353 void set(Key k, const Value& c) { m.set(k, c); } 329 354 }; … … 331 356 ///Sum of two maps 332 357 333 ///This \ refconcepts::ReadMap "read only map" returns the sum of the two358 ///This \c concepts::ReadMap "read only map" returns the sum of the two 334 359 ///given maps. Its \c Key and \c Value will be inherited from \c M1. 335 360 ///The \c Key and \c Value of M2 must be convertible to those of \c M1. … … 347 372 ///Constructor 348 373 AddMap(const M1 &_m1,const M2 &_m2) : m1(_m1), m2(_m2) {}; 374 ///\e 349 375 Value operator[](Key k) const {return m1[k]+m2[k];} 350 376 }; 351 377 352 ///Returns an \ refAddMap class353 354 ///This function just returns an \ refAddMap class.378 ///Returns an \c AddMap class 379 380 ///This function just returns an \c AddMap class. 355 381 ///\todo How to call these type of functions? 356 382 /// 357 383 ///\relates AddMap 358 ///\todo Wrong scope in Doxygen when \c \\relates is used359 384 template<typename M1, typename M2> 360 385 inline AddMap<M1, M2> addMap(const M1 &m1,const M2 &m2) { … … 364 389 ///Shift a map with a constant. 365 390 366 ///This \ refconcepts::ReadMap "read only map" returns the sum of the391 ///This \c concepts::ReadMap "read only map" returns the sum of the 367 392 ///given map and a constant value. 368 393 ///Its \c Key and \c Value is inherited from \c M. … … 392 417 ///\param _v is the shift value 393 418 ShiftMap(const M &_m, const C &_v ) : m(_m), v(_v) {}; 419 ///\e 394 420 Value operator[](Key k) const {return m[k] + v;} 395 421 }; … … 397 423 ///Shift a map with a constant. 398 424 399 ///This \ refconcepts::ReadWriteMap "read-write map" returns the sum of the425 ///This \c concepts::ReadWriteMap "read-write map" returns the sum of the 400 426 ///given map and a constant value. It makes also possible to write the map. 401 427 ///Its \c Key and \c Value is inherited from \c M. … … 425 451 ///\param _v is the shift value 426 452 ShiftWriteMap(M &_m, const C &_v ) : m(_m), v(_v) {}; 453 /// \e 427 454 Value operator[](Key k) const {return m[k] + v;} 455 /// \e 428 456 void set(Key k, const Value& c) { m.set(k, c - v); } 429 457 }; 430 458 431 ///Returns an \ refShiftMap class432 433 ///This function just returns an \ refShiftMap class.459 ///Returns an \c ShiftMap class 460 461 ///This function just returns an \c ShiftMap class. 434 462 ///\relates ShiftMap 435 ///\todo A better name is required.436 463 template<typename M, typename C> 437 464 inline ShiftMap<M, C> shiftMap(const M &m,const C &v) { … … 446 473 ///Difference of two maps 447 474 448 ///This \ refconcepts::ReadMap "read only map" returns the difference475 ///This \c concepts::ReadMap "read only map" returns the difference 449 476 ///of the values of the two 450 477 ///given maps. Its \c Key and \c Value will be inherited from \c M1. … … 462 489 ///Constructor 463 490 SubMap(const M1 &_m1,const M2 &_m2) : m1(_m1), m2(_m2) {}; 491 /// \e 464 492 Value operator[](Key k) const {return m1[k]-m2[k];} 465 493 }; 466 494 467 ///Returns a \ refSubMap class468 469 ///This function just returns a \ refSubMap class.495 ///Returns a \c SubMap class 496 497 ///This function just returns a \c SubMap class. 470 498 /// 471 499 ///\relates SubMap … … 477 505 ///Product of two maps 478 506 479 ///This \ refconcepts::ReadMap "read only map" returns the product of the507 ///This \c concepts::ReadMap "read only map" returns the product of the 480 508 ///values of the two 481 509 ///given … … 494 522 ///Constructor 495 523 MulMap(const M1 &_m1,const M2 &_m2) : m1(_m1), m2(_m2) {}; 524 /// \e 496 525 Value operator[](Key k) const {return m1[k]*m2[k];} 497 526 }; 498 527 499 ///Returns a \ refMulMap class500 501 ///This function just returns a \ refMulMap class.528 ///Returns a \c MulMap class 529 530 ///This function just returns a \c MulMap class. 502 531 ///\relates MulMap 503 532 template<typename M1, typename M2> … … 508 537 ///Scales a maps with a constant. 509 538 510 ///This \ refconcepts::ReadMap "read only map" returns the value of the539 ///This \c concepts::ReadMap "read only map" returns the value of the 511 540 ///given map multiplied from the left side with a constant value. 512 541 ///Its \c Key and \c Value is inherited from \c M. … … 536 565 ///\param _v is the scaling value 537 566 ScaleMap(const M &_m, const C &_v ) : m(_m), v(_v) {}; 567 /// \e 538 568 Value operator[](Key k) const {return v * m[k];} 539 569 }; … … 541 571 ///Scales a maps with a constant. 542 572 543 ///This \ refconcepts::ReadWriteMap "read-write map" returns the value of the573 ///This \c concepts::ReadWriteMap "read-write map" returns the value of the 544 574 ///given map multiplied from the left side with a constant value. It can 545 575 ///be used as write map also if the given multiplier is not zero. … … 560 590 ///\param _v is the scaling value 561 591 ScaleWriteMap(M &_m, const C &_v ) : m(_m), v(_v) {}; 592 /// \e 562 593 Value operator[](Key k) const {return v * m[k];} 594 /// \e 563 595 void set(Key k, const Value& c) { m.set(k, c / v);} 564 596 }; 565 597 566 ///Returns an \ refScaleMap class567 568 ///This function just returns an \ refScaleMap class.598 ///Returns an \c ScaleMap class 599 600 ///This function just returns an \c ScaleMap class. 569 601 ///\relates ScaleMap 570 ///\todo A better name is required.571 602 template<typename M, typename C> 572 603 inline ScaleMap<M, C> scaleMap(const M &m,const C &v) { … … 581 612 ///Quotient of two maps 582 613 583 ///This \ refconcepts::ReadMap "read only map" returns the quotient of the614 ///This \c concepts::ReadMap "read only map" returns the quotient of the 584 615 ///values of the two 585 616 ///given maps. Its \c Key and \c Value will be inherited from \c M1. … … 597 628 ///Constructor 598 629 DivMap(const M1 &_m1,const M2 &_m2) : m1(_m1), m2(_m2) {}; 630 /// \e 599 631 Value operator[](Key k) const {return m1[k]/m2[k];} 600 632 }; 601 633 602 ///Returns a \ refDivMap class603 604 ///This function just returns a \ refDivMap class.634 ///Returns a \c DivMap class 635 636 ///This function just returns a \c DivMap class. 605 637 ///\relates DivMap 606 638 template<typename M1, typename M2> … … 611 643 ///Composition of two maps 612 644 613 ///This \ refconcepts::ReadMap "read only map" returns the composition of645 ///This \c concepts::ReadMap "read only map" returns the composition of 614 646 ///two 615 647 ///given maps. That is to say, if \c m1 is of type \c M1 and \c m2 is … … 625 657 ///The \c M2::Value must be convertible to \c M1::Key. 626 658 ///\todo Check the requirements. 627 628 659 template <typename M1, typename M2> 629 660 class ComposeMap : public MapBase<typename M2::Key, typename M1::Value> { … … 639 670 640 671 typename MapTraits<M1>::ConstReturnValue 672 /// \e 641 673 operator[](Key k) const {return m1[m2[k]];} 642 674 }; 643 ///Returns a \ refComposeMap class644 645 ///This function just returns a \ refComposeMap class.675 ///Returns a \c ComposeMap class 676 677 ///This function just returns a \c ComposeMap class. 646 678 /// 647 679 ///\relates ComposeMap … … 656 688 /// 657 689 /// 658 ///This \ refconcepts::ReadMap "read only map" takes two maps and a690 ///This \c concepts::ReadMap "read only map" takes two maps and a 659 691 ///binary functor and returns the composition of 660 692 ///the two … … 673 705 ///to \c V. 674 706 ///\todo Check the requirements. 675 676 707 template<typename M1, typename M2, typename F, 677 typename V = typename F::result_type, 678 typename NC = False> 708 typename V = typename F::result_type> 679 709 class CombineMap : public MapBase<typename M1::Key, V> { 680 710 const M1& m1; … … 687 717 688 718 ///Constructor 689 CombineMap(const M1 &_m1,const M2 &_m2,const F &_f )719 CombineMap(const M1 &_m1,const M2 &_m2,const F &_f = F()) 690 720 : m1(_m1), m2(_m2), f(_f) {}; 721 /// \e 691 722 Value operator[](Key k) const {return f(m1[k],m2[k]);} 692 723 }; 693 724 694 ///Returns a \ref CombineMap class 695 696 ///This function just returns a \ref CombineMap class. 697 /// 698 ///Only the first template parameter (the value type) must be given. 725 ///Returns a \c CombineMap class 726 727 ///This function just returns a \c CombineMap class. 699 728 /// 700 729 ///For example if \c m1 and \c m2 are both \c double valued maps, then 701 730 ///\code 702 ///combineMap<double>(m1,m2,std::plus<double> )731 ///combineMap<double>(m1,m2,std::plus<double>()) 703 732 ///\endcode 704 733 ///is equivalent with … … 706 735 ///addMap(m1,m2) 707 736 ///\endcode 737 /// 738 ///This function is specialized for adaptable binary function 739 ///classes and c++ functions. 708 740 /// 709 741 ///\relates CombineMap … … 728 760 ///Negative value of a map 729 761 730 ///This \ refconcepts::ReadMap "read only map" returns the negative762 ///This \c concepts::ReadMap "read only map" returns the negative 731 763 ///value of the 732 764 ///value returned by the … … 744 776 ///Constructor 745 777 NegMap(const M &_m) : m(_m) {}; 778 /// \e 746 779 Value operator[](Key k) const {return -m[k];} 747 780 }; … … 749 782 ///Negative value of a map 750 783 751 ///This \ refconcepts::ReadWriteMap "read-write map" returns the negative784 ///This \c concepts::ReadWriteMap "read-write map" returns the negative 752 785 ///value of the value returned by the 753 786 ///given map. Its \c Key and \c Value will be inherited from \c M. … … 764 797 ///Constructor 765 798 NegWriteMap(M &_m) : m(_m) {}; 799 /// \e 766 800 Value operator[](Key k) const {return -m[k];} 801 /// \e 767 802 void set(Key k, const Value& v) { m.set(k, -v); } 768 803 }; 769 804 770 ///Returns a \ refNegMap class771 772 ///This function just returns a \ refNegMap class.805 ///Returns a \c NegMap class 806 807 ///This function just returns a \c NegMap class. 773 808 ///\relates NegMap 774 809 template <typename M> … … 784 819 ///Absolute value of a map 785 820 786 ///This \ refconcepts::ReadMap "read only map" returns the absolute value821 ///This \c concepts::ReadMap "read only map" returns the absolute value 787 822 ///of the 788 823 ///value returned by the … … 815 850 ///Constructor 816 851 AbsMap(const M &_m) : m(_m) {}; 852 /// \e 817 853 Value operator[](Key k) const { 818 854 Value tmp = m[k]; … … 822 858 }; 823 859 824 ///Returns a \ refAbsMap class825 826 ///This function just returns a \ refAbsMap class.860 ///Returns a \c AbsMap class 861 862 ///This function just returns a \c AbsMap class. 827 863 ///\relates AbsMap 828 864 template<typename M> … … 833 869 ///Converts an STL style functor to a map 834 870 835 ///This \ refconcepts::ReadMap "read only map" returns the value871 ///This \c concepts::ReadMap "read only map" returns the value 836 872 ///of a 837 873 ///given map. … … 842 878 /// 843 879 ///Parameter \c F is the type of the used functor. 844 845 846 880 template<typename F, 847 881 typename K = typename F::argument_type, 848 typename V = typename F::result_type, 849 typename NC = False> 882 typename V = typename F::result_type> 850 883 class FunctorMap : public MapBase<K, V> { 851 884 F f; … … 856 889 857 890 ///Constructor 858 FunctorMap(const F &_f ) : f(_f) {}859 891 FunctorMap(const F &_f = F()) : f(_f) {} 892 /// \e 860 893 Value operator[](Key k) const { return f(k);} 861 894 }; 862 895 863 ///Returns a \ref FunctorMap class 864 865 ///This function just returns a \ref FunctorMap class. 866 /// 867 ///The third template parameter isn't necessary to be given. 896 ///Returns a \c FunctorMap class 897 898 ///This function just returns a \c FunctorMap class. 899 /// 900 ///It is specialized for adaptable function classes and 901 ///c++ functions. 868 902 ///\relates FunctorMap 869 903 template<typename K, typename V, typename F> inline … … 891 925 /// 892 926 ///For the sake of convenience it also works as 893 ///a ususal \ refconcepts::ReadMap "readable map",927 ///a ususal \c concepts::ReadMap "readable map", 894 928 ///i.e. <tt>operator[]</tt> and the \c Key and \c Value typedefs also exist. 895 896 929 template <typename M> 897 930 class MapFunctor : public MapBase<typename M::Key, typename M::Value> { … … 902 935 typedef typename Parent::Value Value; 903 936 904 ///\e905 937 typedef typename M::Key argument_type; 906 ///\e907 938 typedef typename M::Value result_type; 908 939 909 940 ///Constructor 910 941 MapFunctor(const M &_m) : m(_m) {}; 911 /// Returns a value of the map942 ///\e 912 943 Value operator()(Key k) const {return m[k];} 913 944 ///\e … … 915 946 }; 916 947 917 ///Returns a \ refMapFunctor class918 919 ///This function just returns a \ refMapFunctor class.948 ///Returns a \c MapFunctor class 949 950 ///This function just returns a \c MapFunctor class. 920 951 ///\relates MapFunctor 921 952 template<typename M> … … 926 957 ///Applies all map setting operations to two maps 927 958 928 ///This map has two \ refconcepts::ReadMap "readable map"959 ///This map has two \c concepts::ReadMap "readable map" 929 960 ///parameters and each read request will be passed just to the 930 961 ///first map. This class is the just readable map type of the ForkWriteMap. … … 932 963 ///The \c Key and \c Value will be inherited from \c M1. 933 964 ///The \c Key and \c Value of M2 must be convertible from those of \c M1. 934 935 965 template<typename M1, typename M2> 936 966 class ForkMap : public MapBase<typename M1::Key, typename M1::Value> { … … 944 974 ///Constructor 945 975 ForkMap(const M1 &_m1, const M2 &_m2) : m1(_m1), m2(_m2) {}; 976 /// \e 946 977 Value operator[](Key k) const {return m1[k];} 947 978 }; … … 950 981 ///Applies all map setting operations to two maps 951 982 952 ///This map has two \ refconcepts::WriteMap "writable map"983 ///This map has two \c concepts::WriteMap "writable map" 953 984 ///parameters and each write request will be passed to both of them. 954 ///If \c M1 is also \ refconcepts::ReadMap "readable",985 ///If \c M1 is also \c concepts::ReadMap "readable", 955 986 ///then the read operations will return the 956 987 ///corresponding values of \c M1. … … 958 989 ///The \c Key and \c Value will be inherited from \c M1. 959 990 ///The \c Key and \c Value of M2 must be convertible from those of \c M1. 960 961 991 template<typename M1, typename M2> 962 992 class ForkWriteMap : public MapBase<typename M1::Key, typename M1::Value> { … … 970 1000 ///Constructor 971 1001 ForkWriteMap(M1 &_m1, M2 &_m2) : m1(_m1), m2(_m2) {}; 1002 ///\e 972 1003 Value operator[](Key k) const {return m1[k];} 1004 ///\e 973 1005 void set(Key k, const Value &v) {m1.set(k,v); m2.set(k,v);} 974 1006 }; 975 1007 976 ///Returns an \ref ForkMap class 977 978 ///This function just returns an \ref ForkMap class. 979 ///\todo How to call these type of functions? 1008 ///Returns an \c ForkMap class 1009 1010 ///This function just returns an \c ForkMap class. 980 1011 /// 981 1012 ///\relates ForkMap 982 ///\todo Wrong scope in Doxygen when \c \\relates is used983 1013 template <typename M1, typename M2> 984 1014 inline ForkMap<M1, M2> forkMap(const M1 &m1, const M2 &m2) { … … 997 1027 ///Logical 'not' of a map 998 1028 999 ///This bool \ refconcepts::ReadMap "read only map" returns the1029 ///This bool \c concepts::ReadMap "read only map" returns the 1000 1030 ///logical negation of 1001 1031 ///value returned by the 1002 1032 ///given map. Its \c Key and will be inherited from \c M, 1003 1033 ///its Value is <tt>bool</tt>. 1004 1005 1034 template <typename M> 1006 1035 class NotMap : public MapBase<typename M::Key, bool> { … … 1013 1042 /// Constructor 1014 1043 NotMap(const M &_m) : m(_m) {}; 1044 ///\e 1015 1045 Value operator[](Key k) const {return !m[k];} 1016 1046 }; … … 1018 1048 ///Logical 'not' of a map with writing possibility 1019 1049 1020 ///This bool \ refconcepts::ReadWriteMap "read-write map" returns the1050 ///This bool \c concepts::ReadWriteMap "read-write map" returns the 1021 1051 ///logical negation of value returned by the given map. When it is set, 1022 1052 ///the opposite value is set to the original map. … … 1033 1063 /// Constructor 1034 1064 NotWriteMap(M &_m) : m(_m) {}; 1065 ///\e 1035 1066 Value operator[](Key k) const {return !m[k];} 1067 ///\e 1036 1068 void set(Key k, bool v) { m.set(k, !v); } 1037 1069 }; 1038 1070 1039 ///Returns a \ refNotMap class1040 1041 ///This function just returns a \ refNotMap class.1071 ///Returns a \c NotMap class 1072 1073 ///This function just returns a \c NotMap class. 1042 1074 ///\relates NotMap 1043 1075 template <typename M> … … 1278 1310 /// } 1279 1311 ///\endcode 1280 1281 1312 template <typename Map> 1282 1313 class FillBoolMap { … … 1326 1357 /// Writable bool map which stores for each true assigned elements 1327 1358 /// the setting order number. It make easy to calculate the leaving 1328 /// order of the nodes in the \ ref dfs "Dfs"algorithm.1359 /// order of the nodes in the \c Dfs algorithm. 1329 1360 /// 1330 1361 ///\code
Note: See TracChangeset
for help on using the changeset viewer.