COIN-OR::LEMON - Graph Library

Changeset 724:d8073df341f6 in lemon-main


Ignore:
Timestamp:
09/25/09 12:22:42 (15 years ago)
Author:
Peter Kovacs <kpeter@…>
Branch:
default
Phase:
public
Message:

Rename ValueIterator? to ValueIt? in graph maps (#302)
but keep ValueIterator? as an alias in CrossRefMap?
(only for reverse compatibility).

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • lemon/maps.h

    r722 r724  
    19081908  /// The graph items can be accessed by their values either using
    19091909  /// \c InverseMap or \c operator()(), and the values of the map can be
    1910   /// accessed with an STL compatible forward iterator (\c ValueIterator).
     1910  /// accessed with an STL compatible forward iterator (\c ValueIt).
    19111911  ///
    19121912  /// This map is intended to be used when all associated values are
     
    19621962    /// They are considered with multiplicity, so each value is
    19631963    /// traversed for each item it is assigned to.
    1964     class ValueIterator
     1964    class ValueIt
    19651965      : public std::iterator<std::forward_iterator_tag, Value> {
    19661966      friend class CrossRefMap;
    19671967    private:
    1968       ValueIterator(typename Container::const_iterator _it)
     1968      ValueIt(typename Container::const_iterator _it)
    19691969        : it(_it) {}
    19701970    public:
    19711971
    19721972      /// Constructor
    1973       ValueIterator() {}
     1973      ValueIt() {}
    19741974
    19751975      /// \e
    1976       ValueIterator& operator++() { ++it; return *this; }
     1976      ValueIt& operator++() { ++it; return *this; }
    19771977      /// \e
    1978       ValueIterator operator++(int) {
    1979         ValueIterator tmp(*this);
     1978      ValueIt operator++(int) {
     1979        ValueIt tmp(*this);
    19801980        operator++();
    19811981        return tmp;
     
    19881988
    19891989      /// \e
    1990       bool operator==(ValueIterator jt) const { return it == jt.it; }
     1990      bool operator==(ValueIt jt) const { return it == jt.it; }
    19911991      /// \e
    1992       bool operator!=(ValueIterator jt) const { return it != jt.it; }
     1992      bool operator!=(ValueIt jt) const { return it != jt.it; }
    19931993
    19941994    private:
    19951995      typename Container::const_iterator it;
    19961996    };
     1997   
     1998    /// Alias for \c ValueIt
     1999    typedef ValueIt ValueIterator;
    19972000
    19982001    /// \brief Returns an iterator to the first value.
     
    20022005    /// map can be accessed in the <tt>[beginValue, endValue)</tt>
    20032006    /// range.
    2004     ValueIterator beginValue() const {
    2005       return ValueIterator(_inv_map.begin());
     2007    ValueIt beginValue() const {
     2008      return ValueIt(_inv_map.begin());
    20062009    }
    20072010
     
    20122015    /// map can be accessed in the <tt>[beginValue, endValue)</tt>
    20132016    /// range.
    2014     ValueIterator endValue() const {
    2015       return ValueIterator(_inv_map.end());
     2017    ValueIt endValue() const {
     2018      return ValueIt(_inv_map.end());
    20162019    }
    20172020
     
    30243027  /// For each value it is possible to iterate on the keys mapped to
    30253028  /// the value (\c ItemIt), and the values of the map can be accessed
    3026   /// with an STL compatible forward iterator (\c ValueIterator).
     3029  /// with an STL compatible forward iterator (\c ValueIt).
    30273030  /// The map stores a linked list for each value, which contains
    30283031  /// the items mapped to the value, and the used values are stored
     
    31123115    /// iterator on the values of the map. The values can
    31133116    /// be accessed in the <tt>[beginValue, endValue)</tt> range.
    3114     class ValueIterator
     3117    class ValueIt
    31153118      : public std::iterator<std::forward_iterator_tag, Value> {
    31163119      friend class IterableValueMap;
    31173120    private:
    3118       ValueIterator(typename std::map<Value, Key>::const_iterator _it)
     3121      ValueIt(typename std::map<Value, Key>::const_iterator _it)
    31193122        : it(_it) {}
    31203123    public:
    31213124
    31223125      /// Constructor
    3123       ValueIterator() {}
     3126      ValueIt() {}
    31243127
    31253128      /// \e
    3126       ValueIterator& operator++() { ++it; return *this; }
     3129      ValueIt& operator++() { ++it; return *this; }
    31273130      /// \e
    3128       ValueIterator operator++(int) {
    3129         ValueIterator tmp(*this);
     3131      ValueIt operator++(int) {
     3132        ValueIt tmp(*this);
    31303133        operator++();
    31313134        return tmp;
     
    31383141
    31393142      /// \e
    3140       bool operator==(ValueIterator jt) const { return it == jt.it; }
     3143      bool operator==(ValueIt jt) const { return it == jt.it; }
    31413144      /// \e
    3142       bool operator!=(ValueIterator jt) const { return it != jt.it; }
     3145      bool operator!=(ValueIt jt) const { return it != jt.it; }
    31433146
    31443147    private:
     
    31523155    /// map can be accessed in the <tt>[beginValue, endValue)</tt>
    31533156    /// range.
    3154     ValueIterator beginValue() const {
    3155       return ValueIterator(_first.begin());
     3157    ValueIt beginValue() const {
     3158      return ValueIt(_first.begin());
    31563159    }
    31573160
     
    31623165    /// map can be accessed in the <tt>[beginValue, endValue)</tt>
    31633166    /// range.
    3164     ValueIterator endValue() const {
    3165       return ValueIterator(_first.end());
     3167    ValueIt endValue() const {
     3168      return ValueIt(_first.end());
    31663169    }
    31673170
     
    32813284  public:
    32823285
    3283     ///\e
     3286    /// The key type (the \c Arc type of the digraph).
    32843287    typedef typename GR::Arc Key;
    3285     ///\e
     3288    /// The value type (the \c Node type of the digraph).
    32863289    typedef typename GR::Node Value;
    32873290
     
    33223325  public:
    33233326
    3324     ///\e
     3327    /// The key type (the \c Arc type of the digraph).
    33253328    typedef typename GR::Arc Key;
    3326     ///\e
     3329    /// The value type (the \c Node type of the digraph).
    33273330    typedef typename GR::Node Value;
    33283331
     
    33643367  public:
    33653368
     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).
    33663372    typedef typename GR::Arc Value;
    3367     typedef typename GR::Edge Key;
    33683373
    33693374    /// \brief Constructor
     
    34043409  public:
    34053410
     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).
    34063414    typedef typename GR::Arc Value;
    3407     typedef typename GR::Edge Key;
    34083415
    34093416    /// \brief Constructor
  • test/maps_test.cc

    r723 r724  
    527527    Graph gr;
    528528    typedef CrossRefMap<Graph, Node, char> CRMap;
    529     typedef CRMap::ValueIterator ValueIt;
    530529    CRMap map(gr);
    531530   
     
    547546          "Wrong CrossRefMap::count()");
    548547   
    549     ValueIt it = map.beginValue();
     548    CRMap::ValueIt it = map.beginValue();
    550549    check(*it++ == 'A' && *it++ == 'B' && *it++ == 'C' &&
    551550          it == map.endValue(), "Wrong value iterator");
     
    743742    }
    744743
    745     for (Ivm::ValueIterator vit = map1.beginValue();
     744    for (Ivm::ValueIt vit = map1.beginValue();
    746745         vit != map1.endValue(); ++vit) {
    747746      check(map1[static_cast<Item>(Ivm::ItemIt(map1, *vit))] == *vit,
    748             "Wrong ValueIterator");
     747            "Wrong ValueIt");
    749748    }
    750749
Note: See TracChangeset for help on using the changeset viewer.