COIN-OR::LEMON - Graph Library

Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/bits/map_extender.h

    r867 r664  
    5050    typedef typename Parent::ConstReference ConstReference;
    5151
    52     typedef typename Parent::ReferenceMapTag ReferenceMapTag;
    53 
    5452    class MapIt;
    5553    class ConstMapIt;
     
    8583      typedef typename Map::Value Value;
    8684
    87       MapIt() : map(NULL) {}
    88 
    89       MapIt(Invalid i) : Parent(i), map(NULL) {}
    90 
    91       explicit MapIt(Map& _map) : map(&_map) {
    92         map->notifier()->first(*this);
     85      MapIt() {}
     86
     87      MapIt(Invalid i) : Parent(i) { }
     88
     89      explicit MapIt(Map& _map) : map(_map) {
     90        map.notifier()->first(*this);
    9391      }
    9492
    9593      MapIt(const Map& _map, const Item& item)
    96         : Parent(item), map(&_map) {}
     94        : Parent(item), map(_map) {}
    9795
    9896      MapIt& operator++() {
    99         map->notifier()->next(*this);
     97        map.notifier()->next(*this);
    10098        return *this;
    10199      }
    102100
    103101      typename MapTraits<Map>::ConstReturnValue operator*() const {
    104         return (*map)[*this];
     102        return map[*this];
    105103      }
    106104
    107105      typename MapTraits<Map>::ReturnValue operator*() {
    108         return (*map)[*this];
     106        return map[*this];
    109107      }
    110108
    111109      void set(const Value& value) {
    112         map->set(*this, value);
    113       }
    114 
    115     protected:
    116       Map* map;
     110        map.set(*this, value);
     111      }
     112
     113    protected:
     114      Map& map;
    117115
    118116    };
     
    125123      typedef typename Map::Value Value;
    126124
    127       ConstMapIt() : map(NULL) {}
    128 
    129       ConstMapIt(Invalid i) : Parent(i), map(NULL) {}
    130 
    131       explicit ConstMapIt(Map& _map) : map(&_map) {
    132         map->notifier()->first(*this);
     125      ConstMapIt() {}
     126
     127      ConstMapIt(Invalid i) : Parent(i) { }
     128
     129      explicit ConstMapIt(Map& _map) : map(_map) {
     130        map.notifier()->first(*this);
    133131      }
    134132
     
    137135
    138136      ConstMapIt& operator++() {
    139         map->notifier()->next(*this);
     137        map.notifier()->next(*this);
    140138        return *this;
    141139      }
     
    146144
    147145    protected:
    148       const Map* map;
     146      const Map& map;
    149147    };
    150148
     
    153151
    154152    public:
    155       ItemIt() : map(NULL) {}
    156 
    157 
    158       ItemIt(Invalid i) : Parent(i), map(NULL) {}
    159 
    160       explicit ItemIt(Map& _map) : map(&_map) {
    161         map->notifier()->first(*this);
     153
     154      ItemIt() {}
     155
     156      ItemIt(Invalid i) : Parent(i) { }
     157
     158      explicit ItemIt(Map& _map) : map(_map) {
     159        map.notifier()->first(*this);
    162160      }
    163161
    164162      ItemIt(const Map& _map, const Item& item)
    165         : Parent(item), map(&_map) {}
     163        : Parent(item), map(_map) {}
    166164
    167165      ItemIt& operator++() {
    168         map->notifier()->next(*this);
    169         return *this;
    170       }
    171 
    172     protected:
    173       const Map* map;
     166        map.notifier()->next(*this);
     167        return *this;
     168      }
     169
     170    protected:
     171      const Map& map;
    174172
    175173    };
     
    194192    typedef typename Parent::ConstReference ConstReference;
    195193
    196     typedef typename Parent::ReferenceMapTag ReferenceMapTag;
    197 
    198194    class MapIt;
    199195    class ConstMapIt;
     
    232228      typedef typename Map::Value Value;
    233229
    234       MapIt() : map(NULL) {}
    235 
    236       MapIt(Invalid i) : Parent(i), map(NULL) { }
    237 
    238       explicit MapIt(Map& _map) : map(&_map) {
    239         map->graph.first(*this);
     230      MapIt() {}
     231
     232      MapIt(Invalid i) : Parent(i) { }
     233
     234      explicit MapIt(Map& _map) : map(_map) {
     235        map.graph.first(*this);
    240236      }
    241237
    242238      MapIt(const Map& _map, const Item& item)
    243         : Parent(item), map(&_map) {}
     239        : Parent(item), map(_map) {}
    244240
    245241      MapIt& operator++() {
    246         map->graph.next(*this);
     242        map.graph.next(*this);
    247243        return *this;
    248244      }
    249245
    250246      typename MapTraits<Map>::ConstReturnValue operator*() const {
    251         return (*map)[*this];
     247        return map[*this];
    252248      }
    253249
    254250      typename MapTraits<Map>::ReturnValue operator*() {
    255         return (*map)[*this];
     251        return map[*this];
    256252      }
    257253
    258254      void set(const Value& value) {
    259         map->set(*this, value);
    260       }
    261 
    262     protected:
    263       Map* map;
     255        map.set(*this, value);
     256      }
     257
     258    protected:
     259      Map& map;
    264260
    265261    };
     
    272268      typedef typename Map::Value Value;
    273269
    274       ConstMapIt() : map(NULL) {}
    275 
    276       ConstMapIt(Invalid i) : Parent(i), map(NULL) { }
    277 
    278       explicit ConstMapIt(Map& _map) : map(&_map) {
    279         map->graph.first(*this);
     270      ConstMapIt() {}
     271
     272      ConstMapIt(Invalid i) : Parent(i) { }
     273
     274      explicit ConstMapIt(Map& _map) : map(_map) {
     275        map.graph.first(*this);
    280276      }
    281277
    282278      ConstMapIt(const Map& _map, const Item& item)
    283         : Parent(item), map(&_map) {}
     279        : Parent(item), map(_map) {}
    284280
    285281      ConstMapIt& operator++() {
    286         map->graph.next(*this);
     282        map.graph.next(*this);
    287283        return *this;
    288284      }
    289285
    290286      typename MapTraits<Map>::ConstReturnValue operator*() const {
    291         return (*map)[*this];
    292       }
    293 
    294     protected:
    295       const Map* map;
     287        return map[*this];
     288      }
     289
     290    protected:
     291      const Map& map;
    296292    };
    297293
     
    300296
    301297    public:
    302       ItemIt() : map(NULL) {}
    303 
    304 
    305       ItemIt(Invalid i) : Parent(i), map(NULL) { }
    306 
    307       explicit ItemIt(Map& _map) : map(&_map) {
    308         map->graph.first(*this);
     298
     299      ItemIt() {}
     300
     301      ItemIt(Invalid i) : Parent(i) { }
     302
     303      explicit ItemIt(Map& _map) : map(_map) {
     304        map.graph.first(*this);
    309305      }
    310306
    311307      ItemIt(const Map& _map, const Item& item)
    312         : Parent(item), map(&_map) {}
     308        : Parent(item), map(_map) {}
    313309
    314310      ItemIt& operator++() {
    315         map->graph.next(*this);
    316         return *this;
    317       }
    318 
    319     protected:
    320       const Map* map;
     311        map.graph.next(*this);
     312        return *this;
     313      }
     314
     315    protected:
     316      const Map& map;
    321317
    322318    };
Note: See TracChangeset for help on using the changeset viewer.