diff -r c6acc34f98dc -r 1a7fe3bef514 lemon/bits/graph_extender.h --- a/lemon/bits/graph_extender.h Fri Oct 16 10:21:37 2009 +0200 +++ b/lemon/bits/graph_extender.h Thu Nov 05 15:50:01 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). * @@ -29,17 +29,18 @@ //\ingroup graphbits //\file -//\brief Extenders for the digraph types +//\brief Extenders for the graph types namespace lemon { // \ingroup graphbits // - // \brief Extender for the Digraphs + // \brief Extender for the digraph implementations template class DigraphExtender : public Base { + typedef Base Parent; + public: - typedef Base Parent; typedef DigraphExtender Digraph; // Base extensions @@ -55,11 +56,11 @@ return Parent::maxArcId(); } - Node fromId(int id, Node) const { + static Node fromId(int id, Node) { return Parent::nodeFromId(id); } - Arc fromId(int id, Arc) const { + static Arc fromId(int id, Arc) { return Parent::arcFromId(id); } @@ -218,10 +219,9 @@ template class NodeMap : public MapExtender > { - public: - typedef DigraphExtender Digraph; typedef MapExtender > Parent; + public: explicit NodeMap(const Digraph& digraph) : Parent(digraph) {} NodeMap(const Digraph& digraph, const _Value& value) @@ -243,10 +243,9 @@ template class ArcMap : public MapExtender > { - public: - typedef DigraphExtender Digraph; typedef MapExtender > Parent; + public: explicit ArcMap(const Digraph& digraph) : Parent(digraph) {} ArcMap(const Digraph& digraph, const _Value& value) @@ -330,9 +329,10 @@ // \brief Extender for the Graphs template class GraphExtender : public Base { + typedef Base Parent; + public: - typedef Base Parent; typedef GraphExtender Graph; typedef True UndirectedTag; @@ -355,15 +355,15 @@ return Parent::maxEdgeId(); } - Node fromId(int id, Node) const { + static Node fromId(int id, Node) { return Parent::nodeFromId(id); } - Arc fromId(int id, Arc) const { + static Arc fromId(int id, Arc) { return Parent::arcFromId(id); } - Edge fromId(int id, Edge) const { + static Edge fromId(int id, Edge) { return Parent::edgeFromId(id); } @@ -601,11 +601,10 @@ template class NodeMap : public MapExtender > { - public: - typedef GraphExtender Graph; typedef MapExtender > Parent; - NodeMap(const Graph& graph) + public: + explicit NodeMap(const Graph& graph) : Parent(graph) {} NodeMap(const Graph& graph, const _Value& value) : Parent(graph, value) {} @@ -626,11 +625,10 @@ template class ArcMap : public MapExtender > { - public: - typedef GraphExtender Graph; typedef MapExtender > Parent; - ArcMap(const Graph& graph) + public: + explicit ArcMap(const Graph& graph) : Parent(graph) {} ArcMap(const Graph& graph, const _Value& value) : Parent(graph, value) {} @@ -651,11 +649,10 @@ template class EdgeMap : public MapExtender > { - public: - typedef GraphExtender Graph; typedef MapExtender > Parent; - EdgeMap(const Graph& graph) + public: + explicit EdgeMap(const Graph& graph) : Parent(graph) {} EdgeMap(const Graph& graph, const _Value& value)