diff -r e9c203fb003d -r 994c7df296c9 lemon/bits/map_extender.h --- a/lemon/bits/map_extender.h Fri Nov 13 12:33:33 2009 +0100 +++ b/lemon/bits/map_extender.h Thu Dec 10 17:05:35 2009 +0100 @@ -2,7 +2,7 @@ * * This file is a part of LEMON, a generic C++ optimization library. * - * Copyright (C) 2003-2008 + * Copyright (C) 2003-2009 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport * (Egervary Research Group on Combinatorial Optimization, EGRES). * @@ -36,17 +36,20 @@ // \brief Extender for maps template class MapExtender : public _Map { + typedef _Map Parent; + typedef typename Parent::GraphType GraphType; + public: - typedef _Map Parent; typedef MapExtender Map; - - - typedef typename Parent::Graph Graph; typedef typename Parent::Key Item; typedef typename Parent::Key Key; typedef typename Parent::Value Value; + typedef typename Parent::Reference Reference; + typedef typename Parent::ConstReference ConstReference; + + typedef typename Parent::ReferenceMapTag ReferenceMapTag; class MapIt; class ConstMapIt; @@ -56,10 +59,10 @@ public: - MapExtender(const Graph& graph) + MapExtender(const GraphType& graph) : Parent(graph) {} - MapExtender(const Graph& graph, const Value& value) + MapExtender(const GraphType& graph, const Value& value) : Parent(graph, value) {} private: @@ -75,9 +78,10 @@ public: class MapIt : public Item { + typedef Item Parent; + public: - typedef Item Parent; typedef typename Map::Value Value; MapIt() : map(NULL) {} @@ -114,10 +118,10 @@ }; class ConstMapIt : public Item { + typedef Item Parent; + public: - typedef Item Parent; - typedef typename Map::Value Value; ConstMapIt() : map(NULL) {} @@ -145,12 +149,12 @@ }; class ItemIt : public Item { - public: - typedef Item Parent; + public: ItemIt() : map(NULL) {} + ItemIt(Invalid i) : Parent(i), map(NULL) {} explicit ItemIt(Map& _map) : map(&_map) { @@ -176,17 +180,20 @@ // \brief Extender for maps which use a subset of the items. template class SubMapExtender : public _Map { + typedef _Map Parent; + typedef _Graph GraphType; + public: - typedef _Map Parent; typedef SubMapExtender Map; - - typedef _Graph Graph; - typedef typename Parent::Key Item; typedef typename Parent::Key Key; typedef typename Parent::Value Value; + typedef typename Parent::Reference Reference; + typedef typename Parent::ConstReference ConstReference; + + typedef typename Parent::ReferenceMapTag ReferenceMapTag; class MapIt; class ConstMapIt; @@ -196,10 +203,10 @@ public: - SubMapExtender(const Graph& _graph) + SubMapExtender(const GraphType& _graph) : Parent(_graph), graph(_graph) {} - SubMapExtender(const Graph& _graph, const Value& _value) + SubMapExtender(const GraphType& _graph, const Value& _value) : Parent(_graph, _value), graph(_graph) {} private: @@ -219,9 +226,9 @@ public: class MapIt : public Item { + typedef Item Parent; + public: - - typedef Item Parent; typedef typename Map::Value Value; MapIt() : map(NULL) {} @@ -258,10 +265,10 @@ }; class ConstMapIt : public Item { + typedef Item Parent; + public: - typedef Item Parent; - typedef typename Map::Value Value; ConstMapIt() : map(NULL) {} @@ -289,12 +296,12 @@ }; class ItemIt : public Item { - public: - typedef Item Parent; + public: ItemIt() : map(NULL) {} + ItemIt(Invalid i) : Parent(i), map(NULL) { } explicit ItemIt(Map& _map) : map(&_map) { @@ -316,7 +323,7 @@ private: - const Graph& graph; + const GraphType& graph; };