diff --git a/lemon/graph_utils.h b/lemon/graph_utils.h --- a/lemon/graph_utils.h +++ b/lemon/graph_utils.h @@ -42,136 +42,83 @@ /// \addtogroup gutils /// @{ - namespace _graph_utils_bits { - template - struct Node { typedef typename Graph::Node type; }; - - template - struct NodeIt { typedef typename Graph::NodeIt type; }; - - template - struct Arc { typedef typename Graph::Arc type; }; - - template - struct ArcIt { typedef typename Graph::ArcIt type; }; - - template - struct Edge { typedef typename Graph::Edge type; }; - - template - struct EdgeIt { typedef typename Graph::EdgeIt type; }; - - template - struct OutArcIt { typedef typename Graph::OutArcIt type; }; - - template - struct InArcIt { typedef typename Graph::InArcIt type; }; - - template - struct IncEdgeIt { typedef typename Graph::IncEdgeIt type; }; - - template - struct BoolNodeMap { - typedef typename Graph::template NodeMap type; - }; - - template - struct IntNodeMap { - typedef typename Graph::template NodeMap type; - }; - - template - struct DoubleNodeMap { - typedef typename Graph::template NodeMap type; - }; - - template - struct BoolArcMap { - typedef typename Graph::template ArcMap type; - }; - - template - struct IntArcMap { - typedef typename Graph::template ArcMap type; - }; - - template - struct DoubleArcMap { - typedef typename Graph::template ArcMap type; - }; - - template - struct BoolEdgeMap { - typedef typename Graph::template EdgeMap type; - }; - - template - struct IntEdgeMap { - typedef typename Graph::template EdgeMap type; - }; - - template - struct DoubleEdgeMap { - typedef typename Graph::template EdgeMap type; - }; - - - } - ///Creates convenience typedefs for the digraph types and iterators ///This \c \#define creates convenience typedefs for the following types ///of \c Digraph: \c Node, \c NodeIt, \c Arc, \c ArcIt, \c InArcIt, ///\c OutArcIt, \c BoolNodeMap, \c IntNodeMap, \c DoubleNodeMap, - ///\c BoolArcMap, \c IntArcMap, \c DoubleArcMap. + ///\c BoolArcMap, \c IntArcMap, \c DoubleArcMap. + /// + ///\note If the graph type is a dependent type, ie. the graph type depend + ///on a template parameter, then use \c TEMPLATE_DIGRAPH_TYPEDEFS() + ///macro. #define DIGRAPH_TYPEDEFS(Digraph) \ - typedef typename ::lemon::_graph_utils_bits:: \ - Node::type Node; \ - typedef typename ::lemon::_graph_utils_bits:: \ - NodeIt::type NodeIt; \ - typedef typename ::lemon::_graph_utils_bits:: \ - Arc::type Arc; \ - typedef typename ::lemon::_graph_utils_bits:: \ - ArcIt::type ArcIt; \ - typedef typename ::lemon::_graph_utils_bits:: \ - OutArcIt::type OutArcIt; \ - typedef typename ::lemon::_graph_utils_bits:: \ - InArcIt::type InArcIt; \ - typedef typename ::lemon::_graph_utils_bits:: \ - BoolNodeMap::type BoolNodeMap; \ - typedef typename ::lemon::_graph_utils_bits:: \ - IntNodeMap::type IntNodeMap; \ - typedef typename ::lemon::_graph_utils_bits:: \ - DoubleNodeMap::type DoubleNodeMap; \ - typedef typename ::lemon::_graph_utils_bits:: \ - BoolArcMap::type BoolArcMap; \ - typedef typename ::lemon::_graph_utils_bits:: \ - IntArcMap::type IntArcMap; \ - typedef typename ::lemon::_graph_utils_bits:: \ - DoubleArcMap::type DoubleArcMap + typedef Digraph::Node Node; \ + typedef Digraph::NodeIt NodeIt; \ + typedef Digraph::Arc Arc; \ + typedef Digraph::ArcIt ArcIt; \ + typedef Digraph::InArcIt InArcIt; \ + typedef Digraph::OutArcIt OutArcIt; \ + typedef Digraph::NodeMap BoolNodeMap; \ + typedef Digraph::NodeMap IntNodeMap; \ + typedef Digraph::NodeMap DoubleNodeMap; \ + typedef Digraph::ArcMap BoolArcMap; \ + typedef Digraph::ArcMap IntArcMap; \ + typedef Digraph::ArcMap DoubleArcMap + ///Creates convenience typedefs for the digraph types and iterators + ///\see DIGRAPH_TYPEDEFS + /// + ///\note Use this macro, if the graph type is a dependent type, + ///ie. the graph type depend on a template parameter. +#define TEMPLATE_DIGRAPH_TYPEDEFS(Digraph) \ + typedef typename Digraph::Node Node; \ + typedef typename Digraph::NodeIt NodeIt; \ + typedef typename Digraph::Arc Arc; \ + typedef typename Digraph::ArcIt ArcIt; \ + typedef typename Digraph::InArcIt InArcIt; \ + typedef typename Digraph::OutArcIt OutArcIt; \ + typedef typename Digraph::template NodeMap BoolNodeMap; \ + typedef typename Digraph::template NodeMap IntNodeMap; \ + typedef typename Digraph::template NodeMap DoubleNodeMap; \ + typedef typename Digraph::template ArcMap BoolArcMap; \ + typedef typename Digraph::template ArcMap IntArcMap; \ + typedef typename Digraph::template ArcMap DoubleArcMap + ///Creates convenience typedefs for the graph types and iterators ///This \c \#define creates the same convenience typedefs as defined ///by \ref DIGRAPH_TYPEDEFS(Graph) and six more, namely it creates ///\c Edge, \c EdgeIt, \c IncEdgeIt, \c BoolEdgeMap, \c IntEdgeMap, ///\c DoubleEdgeMap. + /// + ///\note If the graph type is a dependent type, ie. the graph type depend + ///on a template parameter, then use \c TEMPLATE_DIGRAPH_TYPEDEFS() + ///macro. #define GRAPH_TYPEDEFS(Graph) \ DIGRAPH_TYPEDEFS(Graph); \ - typedef typename ::lemon::_graph_utils_bits:: \ - Edge::type Edge; \ - typedef typename ::lemon::_graph_utils_bits:: \ - EdgeIt::type EdgeIt; \ - typedef typename ::lemon::_graph_utils_bits:: \ - IncEdgeIt::type IncEdgeIt; \ - typedef typename ::lemon::_graph_utils_bits:: \ - BoolEdgeMap::type BoolEdgeMap; \ - typedef typename ::lemon::_graph_utils_bits:: \ - IntEdgeMap::type IntEdgeMap; \ - typedef typename ::lemon::_graph_utils_bits:: \ - DoubleEdgeMap::type DoubleEdgeMap + typedef Graph::Edge Edge; \ + typedef Graph::EdgeIt EdgeIt; \ + typedef Graph::IncEdgeIt IncEdgeIt; \ + typedef Graph::EdgeMap BoolEdgeMap; \ + typedef Graph::EdgeMap IntEdgeMap; \ + typedef Graph::EdgeMap DoubleEdgeMap + ///Creates convenience typedefs for the graph types and iterators + + ///\see GRAPH_TYPEDEFS + /// + ///\note Use this macro, if the graph type is a dependent type, + ///ie. the graph type depend on a template parameter. +#define TEMPLATE_GRAPH_TYPEDEFS(Graph) \ + TEMPLATE_DIGRAPH_TYPEDEFS(Graph); \ + typedef typename Graph::Edge Edge; \ + typedef typename Graph::EdgeIt EdgeIt; \ + typedef typename Graph::IncEdgeIt IncEdgeIt; \ + typedef typename Graph::template EdgeMap BoolEdgeMap; \ + typedef typename Graph::template EdgeMap IntEdgeMap; \ + typedef typename Graph::template EdgeMap DoubleEdgeMap /// \brief Function to count the items in the graph. /// @@ -2161,7 +2108,7 @@ typedef typename ItemSetTraits ::ItemNotifier::ObserverBase Parent; - DIGRAPH_TYPEDEFS(G); + TEMPLATE_DIGRAPH_TYPEDEFS(G); typedef G Digraph; protected: @@ -2598,7 +2545,7 @@ class ArcLookUp { public: - DIGRAPH_TYPEDEFS(G); + TEMPLATE_DIGRAPH_TYPEDEFS(G); typedef G Digraph; protected: @@ -2715,7 +2662,7 @@ using ArcLookUp::_left; using ArcLookUp::_head; - DIGRAPH_TYPEDEFS(G); + TEMPLATE_DIGRAPH_TYPEDEFS(G); typedef G Digraph; typename Digraph::template ArcMap _next; diff --git a/lemon/lgf_reader.h b/lemon/lgf_reader.h --- a/lemon/lgf_reader.h +++ b/lemon/lgf_reader.h @@ -302,7 +302,7 @@ public: typedef _Digraph Digraph; - DIGRAPH_TYPEDEFS(Digraph); + TEMPLATE_DIGRAPH_TYPEDEFS(Digraph); private: diff --git a/lemon/lgf_writer.h b/lemon/lgf_writer.h --- a/lemon/lgf_writer.h +++ b/lemon/lgf_writer.h @@ -237,7 +237,7 @@ public: typedef _Digraph Digraph; - DIGRAPH_TYPEDEFS(Digraph); + TEMPLATE_DIGRAPH_TYPEDEFS(Digraph); private: