Changeset 771:d8073df341f6 in lemon for lemon/maps.h
- Timestamp:
- 09/25/09 12:22:42 (15 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/maps.h
r769 r771 1908 1908 /// The graph items can be accessed by their values either using 1909 1909 /// \c InverseMap or \c operator()(), and the values of the map can be 1910 /// accessed with an STL compatible forward iterator (\c ValueIt erator).1910 /// accessed with an STL compatible forward iterator (\c ValueIt). 1911 1911 /// 1912 1912 /// This map is intended to be used when all associated values are … … 1962 1962 /// They are considered with multiplicity, so each value is 1963 1963 /// traversed for each item it is assigned to. 1964 class ValueIt erator1964 class ValueIt 1965 1965 : public std::iterator<std::forward_iterator_tag, Value> { 1966 1966 friend class CrossRefMap; 1967 1967 private: 1968 ValueIt erator(typename Container::const_iterator _it)1968 ValueIt(typename Container::const_iterator _it) 1969 1969 : it(_it) {} 1970 1970 public: 1971 1971 1972 1972 /// Constructor 1973 ValueIt erator() {}1973 ValueIt() {} 1974 1974 1975 1975 /// \e 1976 ValueIt erator& operator++() { ++it; return *this; }1976 ValueIt& operator++() { ++it; return *this; } 1977 1977 /// \e 1978 ValueIt eratoroperator++(int) {1979 ValueIt eratortmp(*this);1978 ValueIt operator++(int) { 1979 ValueIt tmp(*this); 1980 1980 operator++(); 1981 1981 return tmp; … … 1988 1988 1989 1989 /// \e 1990 bool operator==(ValueIt eratorjt) const { return it == jt.it; }1990 bool operator==(ValueIt jt) const { return it == jt.it; } 1991 1991 /// \e 1992 bool operator!=(ValueIt eratorjt) const { return it != jt.it; }1992 bool operator!=(ValueIt jt) const { return it != jt.it; } 1993 1993 1994 1994 private: 1995 1995 typename Container::const_iterator it; 1996 1996 }; 1997 1998 /// Alias for \c ValueIt 1999 typedef ValueIt ValueIterator; 1997 2000 1998 2001 /// \brief Returns an iterator to the first value. … … 2002 2005 /// map can be accessed in the <tt>[beginValue, endValue)</tt> 2003 2006 /// range. 2004 ValueIt eratorbeginValue() const {2005 return ValueIt erator(_inv_map.begin());2007 ValueIt beginValue() const { 2008 return ValueIt(_inv_map.begin()); 2006 2009 } 2007 2010 … … 2012 2015 /// map can be accessed in the <tt>[beginValue, endValue)</tt> 2013 2016 /// range. 2014 ValueIt eratorendValue() const {2015 return ValueIt erator(_inv_map.end());2017 ValueIt endValue() const { 2018 return ValueIt(_inv_map.end()); 2016 2019 } 2017 2020 … … 3024 3027 /// For each value it is possible to iterate on the keys mapped to 3025 3028 /// the value (\c ItemIt), and the values of the map can be accessed 3026 /// with an STL compatible forward iterator (\c ValueIt erator).3029 /// with an STL compatible forward iterator (\c ValueIt). 3027 3030 /// The map stores a linked list for each value, which contains 3028 3031 /// the items mapped to the value, and the used values are stored … … 3112 3115 /// iterator on the values of the map. The values can 3113 3116 /// be accessed in the <tt>[beginValue, endValue)</tt> range. 3114 class ValueIt erator3117 class ValueIt 3115 3118 : public std::iterator<std::forward_iterator_tag, Value> { 3116 3119 friend class IterableValueMap; 3117 3120 private: 3118 ValueIt erator(typename std::map<Value, Key>::const_iterator _it)3121 ValueIt(typename std::map<Value, Key>::const_iterator _it) 3119 3122 : it(_it) {} 3120 3123 public: 3121 3124 3122 3125 /// Constructor 3123 ValueIt erator() {}3126 ValueIt() {} 3124 3127 3125 3128 /// \e 3126 ValueIt erator& operator++() { ++it; return *this; }3129 ValueIt& operator++() { ++it; return *this; } 3127 3130 /// \e 3128 ValueIt eratoroperator++(int) {3129 ValueIt eratortmp(*this);3131 ValueIt operator++(int) { 3132 ValueIt tmp(*this); 3130 3133 operator++(); 3131 3134 return tmp; … … 3138 3141 3139 3142 /// \e 3140 bool operator==(ValueIt eratorjt) const { return it == jt.it; }3143 bool operator==(ValueIt jt) const { return it == jt.it; } 3141 3144 /// \e 3142 bool operator!=(ValueIt eratorjt) const { return it != jt.it; }3145 bool operator!=(ValueIt jt) const { return it != jt.it; } 3143 3146 3144 3147 private: … … 3152 3155 /// map can be accessed in the <tt>[beginValue, endValue)</tt> 3153 3156 /// range. 3154 ValueIt eratorbeginValue() const {3155 return ValueIt erator(_first.begin());3157 ValueIt beginValue() const { 3158 return ValueIt(_first.begin()); 3156 3159 } 3157 3160 … … 3162 3165 /// map can be accessed in the <tt>[beginValue, endValue)</tt> 3163 3166 /// range. 3164 ValueIt eratorendValue() const {3165 return ValueIt erator(_first.end());3167 ValueIt endValue() const { 3168 return ValueIt(_first.end()); 3166 3169 } 3167 3170 … … 3281 3284 public: 3282 3285 3283 /// \e3286 /// The key type (the \c Arc type of the digraph). 3284 3287 typedef typename GR::Arc Key; 3285 /// \e3288 /// The value type (the \c Node type of the digraph). 3286 3289 typedef typename GR::Node Value; 3287 3290 … … 3322 3325 public: 3323 3326 3324 /// \e3327 /// The key type (the \c Arc type of the digraph). 3325 3328 typedef typename GR::Arc Key; 3326 /// \e3329 /// The value type (the \c Node type of the digraph). 3327 3330 typedef typename GR::Node Value; 3328 3331 … … 3364 3367 public: 3365 3368 3369 /// The key type (the \c Edge type of the digraph). 3370 typedef typename GR::Edge Key; 3371 /// The value type (the \c Arc type of the digraph). 3366 3372 typedef typename GR::Arc Value; 3367 typedef typename GR::Edge Key;3368 3373 3369 3374 /// \brief Constructor … … 3404 3409 public: 3405 3410 3411 /// The key type (the \c Edge type of the digraph). 3412 typedef typename GR::Edge Key; 3413 /// The value type (the \c Arc type of the digraph). 3406 3414 typedef typename GR::Arc Value; 3407 typedef typename GR::Edge Key;3408 3415 3409 3416 /// \brief Constructor
Note: See TracChangeset
for help on using the changeset viewer.