COIN-OR::LEMON - Graph Library

Ignore:
Timestamp:
02/26/10 17:08:30 (14 years ago)
Author:
Alpar Juttner <alpar@…>
Branch:
1.1
Parents:
908:c6f725eff737 (diff), 912:37f440367057 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Phase:
public
Message:

Merge 4 backouts (#50, #312)

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • lemon/bits/map_extender.h

    r867 r913  
    5050    typedef typename Parent::ConstReference ConstReference;
    5151
    52     typedef typename Parent::ReferenceMapTag ReferenceMapTag;
    53 
    5452    class MapIt;
    5553    class ConstMapIt;
     
    194192    typedef typename Parent::ConstReference ConstReference;
    195193
    196     typedef typename Parent::ReferenceMapTag ReferenceMapTag;
    197 
    198194    class MapIt;
    199195    class ConstMapIt;
  • lemon/bits/map_extender.h

    r912 r913  
    8383      typedef typename Map::Value Value;
    8484
    85       MapIt() {}
    86 
    87       MapIt(Invalid i) : Parent(i) { }
    88 
    89       explicit MapIt(Map& _map) : map(_map) {
    90         map.notifier()->first(*this);
     85      MapIt() : map(NULL) {}
     86
     87      MapIt(Invalid i) : Parent(i), map(NULL) {}
     88
     89      explicit MapIt(Map& _map) : map(&_map) {
     90        map->notifier()->first(*this);
    9191      }
    9292
    9393      MapIt(const Map& _map, const Item& item)
     94        : Parent(item), map(&_map) {}
     95
     96      MapIt& operator++() {
     97        map->notifier()->next(*this);
     98        return *this;
     99      }
     100
     101      typename MapTraits<Map>::ConstReturnValue operator*() const {
     102        return (*map)[*this];
     103      }
     104
     105      typename MapTraits<Map>::ReturnValue operator*() {
     106        return (*map)[*this];
     107      }
     108
     109      void set(const Value& value) {
     110        map->set(*this, value);
     111      }
     112
     113    protected:
     114      Map* map;
     115
     116    };
     117
     118    class ConstMapIt : public Item {
     119      typedef Item Parent;
     120
     121    public:
     122
     123      typedef typename Map::Value Value;
     124
     125      ConstMapIt() : map(NULL) {}
     126
     127      ConstMapIt(Invalid i) : Parent(i), map(NULL) {}
     128
     129      explicit ConstMapIt(Map& _map) : map(&_map) {
     130        map->notifier()->first(*this);
     131      }
     132
     133      ConstMapIt(const Map& _map, const Item& item)
    94134        : Parent(item), map(_map) {}
    95135
    96       MapIt& operator++() {
    97         map.notifier()->next(*this);
     136      ConstMapIt& operator++() {
     137        map->notifier()->next(*this);
    98138        return *this;
    99139      }
     
    103143      }
    104144
    105       typename MapTraits<Map>::ReturnValue operator*() {
    106         return map[*this];
    107       }
    108 
    109       void set(const Value& value) {
    110         map.set(*this, value);
    111       }
    112 
    113     protected:
    114       Map& map;
    115 
    116     };
    117 
    118     class ConstMapIt : public Item {
    119       typedef Item Parent;
    120 
    121     public:
    122 
    123       typedef typename Map::Value Value;
    124 
    125       ConstMapIt() {}
    126 
    127       ConstMapIt(Invalid i) : Parent(i) { }
    128 
    129       explicit ConstMapIt(Map& _map) : map(_map) {
    130         map.notifier()->first(*this);
    131       }
    132 
    133       ConstMapIt(const Map& _map, const Item& item)
    134         : Parent(item), map(_map) {}
    135 
    136       ConstMapIt& operator++() {
    137         map.notifier()->next(*this);
    138         return *this;
    139       }
    140 
    141       typename MapTraits<Map>::ConstReturnValue operator*() const {
    142         return map[*this];
    143       }
    144 
    145     protected:
    146       const Map& map;
     145    protected:
     146      const Map* map;
    147147    };
    148148
     
    151151
    152152    public:
    153 
    154       ItemIt() {}
    155 
    156       ItemIt(Invalid i) : Parent(i) { }
    157 
    158       explicit ItemIt(Map& _map) : map(_map) {
    159         map.notifier()->first(*this);
     153      ItemIt() : map(NULL) {}
     154
     155
     156      ItemIt(Invalid i) : Parent(i), map(NULL) {}
     157
     158      explicit ItemIt(Map& _map) : map(&_map) {
     159        map->notifier()->first(*this);
    160160      }
    161161
    162162      ItemIt(const Map& _map, const Item& item)
    163         : Parent(item), map(_map) {}
     163        : Parent(item), map(&_map) {}
    164164
    165165      ItemIt& operator++() {
    166         map.notifier()->next(*this);
    167         return *this;
    168       }
    169 
    170     protected:
    171       const Map& map;
     166        map->notifier()->next(*this);
     167        return *this;
     168      }
     169
     170    protected:
     171      const Map* map;
    172172
    173173    };
     
    228228      typedef typename Map::Value Value;
    229229
    230       MapIt() {}
    231 
    232       MapIt(Invalid i) : Parent(i) { }
    233 
    234       explicit MapIt(Map& _map) : map(_map) {
    235         map.graph.first(*this);
     230      MapIt() : map(NULL) {}
     231
     232      MapIt(Invalid i) : Parent(i), map(NULL) { }
     233
     234      explicit MapIt(Map& _map) : map(&_map) {
     235        map->graph.first(*this);
    236236      }
    237237
    238238      MapIt(const Map& _map, const Item& item)
    239         : Parent(item), map(_map) {}
     239        : Parent(item), map(&_map) {}
    240240
    241241      MapIt& operator++() {
    242         map.graph.next(*this);
     242        map->graph.next(*this);
    243243        return *this;
    244244      }
    245245
    246246      typename MapTraits<Map>::ConstReturnValue operator*() const {
    247         return map[*this];
     247        return (*map)[*this];
    248248      }
    249249
    250250      typename MapTraits<Map>::ReturnValue operator*() {
    251         return map[*this];
     251        return (*map)[*this];
    252252      }
    253253
    254254      void set(const Value& value) {
    255         map.set(*this, value);
    256       }
    257 
    258     protected:
    259       Map& map;
     255        map->set(*this, value);
     256      }
     257
     258    protected:
     259      Map* map;
    260260
    261261    };
     
    268268      typedef typename Map::Value Value;
    269269
    270       ConstMapIt() {}
    271 
    272       ConstMapIt(Invalid i) : Parent(i) { }
    273 
    274       explicit ConstMapIt(Map& _map) : map(_map) {
    275         map.graph.first(*this);
     270      ConstMapIt() : map(NULL) {}
     271
     272      ConstMapIt(Invalid i) : Parent(i), map(NULL) { }
     273
     274      explicit ConstMapIt(Map& _map) : map(&_map) {
     275        map->graph.first(*this);
    276276      }
    277277
    278278      ConstMapIt(const Map& _map, const Item& item)
    279         : Parent(item), map(_map) {}
     279        : Parent(item), map(&_map) {}
    280280
    281281      ConstMapIt& operator++() {
    282         map.graph.next(*this);
     282        map->graph.next(*this);
    283283        return *this;
    284284      }
    285285
    286286      typename MapTraits<Map>::ConstReturnValue operator*() const {
    287         return map[*this];
    288       }
    289 
    290     protected:
    291       const Map& map;
     287        return (*map)[*this];
     288      }
     289
     290    protected:
     291      const Map* map;
    292292    };
    293293
     
    296296
    297297    public:
    298 
    299       ItemIt() {}
    300 
    301       ItemIt(Invalid i) : Parent(i) { }
    302 
    303       explicit ItemIt(Map& _map) : map(_map) {
    304         map.graph.first(*this);
     298      ItemIt() : map(NULL) {}
     299
     300
     301      ItemIt(Invalid i) : Parent(i), map(NULL) { }
     302
     303      explicit ItemIt(Map& _map) : map(&_map) {
     304        map->graph.first(*this);
    305305      }
    306306
    307307      ItemIt(const Map& _map, const Item& item)
    308         : Parent(item), map(_map) {}
     308        : Parent(item), map(&_map) {}
    309309
    310310      ItemIt& operator++() {
    311         map.graph.next(*this);
    312         return *this;
    313       }
    314 
    315     protected:
    316       const Map& map;
     311        map->graph.next(*this);
     312        return *this;
     313      }
     314
     315    protected:
     316      const Map* map;
    317317
    318318    };
Note: See TracChangeset for help on using the changeset viewer.