# HG changeset patch # User Alpar Juttner # Date 1260460586 -3600 # Node ID 2e965540277828a161e79095450a4e6f06ff1dab # Parent bfe8377ba349e76d72a23aff8f1272e8c69d549e# Parent e9c203fb003d6d603fedbfe94a10ec308645e8ea Merge bugfix #330 to branch 1.0 diff -r bfe8377ba349 -r 2e9655402778 lemon/bits/map_extender.h --- a/lemon/bits/map_extender.h Thu Nov 05 16:00:44 2009 +0100 +++ b/lemon/bits/map_extender.h Thu Dec 10 16:56:26 2009 +0100 @@ -80,36 +80,36 @@ typedef Item Parent; typedef typename Map::Value Value; - MapIt() {} + MapIt() : map(NULL) {} - MapIt(Invalid i) : Parent(i) { } + MapIt(Invalid i) : Parent(i), map(NULL) {} - explicit MapIt(Map& _map) : map(_map) { - map.notifier()->first(*this); + explicit MapIt(Map& _map) : map(&_map) { + map->notifier()->first(*this); } MapIt(const Map& _map, const Item& item) - : Parent(item), map(_map) {} + : Parent(item), map(&_map) {} MapIt& operator++() { - map.notifier()->next(*this); + map->notifier()->next(*this); return *this; } typename MapTraits::ConstReturnValue operator*() const { - return map[*this]; + return (*map)[*this]; } typename MapTraits::ReturnValue operator*() { - return map[*this]; + return (*map)[*this]; } void set(const Value& value) { - map.set(*this, value); + map->set(*this, value); } protected: - Map& map; + Map* map; }; @@ -120,19 +120,19 @@ typedef typename Map::Value Value; - ConstMapIt() {} + ConstMapIt() : map(NULL) {} - ConstMapIt(Invalid i) : Parent(i) { } + ConstMapIt(Invalid i) : Parent(i), map(NULL) {} - explicit ConstMapIt(Map& _map) : map(_map) { - map.notifier()->first(*this); + explicit ConstMapIt(Map& _map) : map(&_map) { + map->notifier()->first(*this); } ConstMapIt(const Map& _map, const Item& item) : Parent(item), map(_map) {} ConstMapIt& operator++() { - map.notifier()->next(*this); + map->notifier()->next(*this); return *this; } @@ -141,7 +141,7 @@ } protected: - const Map& map; + const Map* map; }; class ItemIt : public Item { @@ -149,24 +149,24 @@ typedef Item Parent; - ItemIt() {} + ItemIt() : map(NULL) {} - ItemIt(Invalid i) : Parent(i) { } + ItemIt(Invalid i) : Parent(i), map(NULL) {} - explicit ItemIt(Map& _map) : map(_map) { - map.notifier()->first(*this); + explicit ItemIt(Map& _map) : map(&_map) { + map->notifier()->first(*this); } ItemIt(const Map& _map, const Item& item) - : Parent(item), map(_map) {} + : Parent(item), map(&_map) {} ItemIt& operator++() { - map.notifier()->next(*this); + map->notifier()->next(*this); return *this; } protected: - const Map& map; + const Map* map; }; }; @@ -224,36 +224,36 @@ typedef Item Parent; typedef typename Map::Value Value; - MapIt() {} + MapIt() : map(NULL) {} - MapIt(Invalid i) : Parent(i) { } + MapIt(Invalid i) : Parent(i), map(NULL) { } - explicit MapIt(Map& _map) : map(_map) { - map.graph.first(*this); + explicit MapIt(Map& _map) : map(&_map) { + map->graph.first(*this); } MapIt(const Map& _map, const Item& item) - : Parent(item), map(_map) {} + : Parent(item), map(&_map) {} MapIt& operator++() { - map.graph.next(*this); + map->graph.next(*this); return *this; } typename MapTraits::ConstReturnValue operator*() const { - return map[*this]; + return (*map)[*this]; } typename MapTraits::ReturnValue operator*() { - return map[*this]; + return (*map)[*this]; } void set(const Value& value) { - map.set(*this, value); + map->set(*this, value); } protected: - Map& map; + Map* map; }; @@ -264,28 +264,28 @@ typedef typename Map::Value Value; - ConstMapIt() {} + ConstMapIt() : map(NULL) {} - ConstMapIt(Invalid i) : Parent(i) { } + ConstMapIt(Invalid i) : Parent(i), map(NULL) { } - explicit ConstMapIt(Map& _map) : map(_map) { - map.graph.first(*this); + explicit ConstMapIt(Map& _map) : map(&_map) { + map->graph.first(*this); } ConstMapIt(const Map& _map, const Item& item) - : Parent(item), map(_map) {} + : Parent(item), map(&_map) {} ConstMapIt& operator++() { - map.graph.next(*this); + map->graph.next(*this); return *this; } typename MapTraits::ConstReturnValue operator*() const { - return map[*this]; + return (*map)[*this]; } protected: - const Map& map; + const Map* map; }; class ItemIt : public Item { @@ -293,24 +293,24 @@ typedef Item Parent; - ItemIt() {} + ItemIt() : map(NULL) {} - ItemIt(Invalid i) : Parent(i) { } + ItemIt(Invalid i) : Parent(i), map(NULL) { } - explicit ItemIt(Map& _map) : map(_map) { - map.graph.first(*this); + explicit ItemIt(Map& _map) : map(&_map) { + map->graph.first(*this); } ItemIt(const Map& _map, const Item& item) - : Parent(item), map(_map) {} + : Parent(item), map(&_map) {} ItemIt& operator++() { - map.graph.next(*this); + map->graph.next(*this); return *this; } protected: - const Map& map; + const Map* map; };