diff -r c6acc34f98dc -r 1a7fe3bef514 lemon/bits/traits.h --- a/lemon/bits/traits.h Fri Oct 16 10:21:37 2009 +0200 +++ b/lemon/bits/traits.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,117 +29,123 @@ struct InvalidType {}; - template + template class ItemSetTraits {}; - template + template struct NodeNotifierIndicator { typedef InvalidType Type; }; - template + template struct NodeNotifierIndicator< - Graph, - typename enable_if::type + GR, + typename enable_if::type > { - typedef typename Graph::NodeNotifier Type; + typedef typename GR::NodeNotifier Type; }; - template - class ItemSetTraits<_Graph, typename _Graph::Node> { + template + class ItemSetTraits { public: - typedef _Graph Graph; + typedef GR Graph; + typedef GR Digraph; - typedef typename Graph::Node Item; - typedef typename Graph::NodeIt ItemIt; + typedef typename GR::Node Item; + typedef typename GR::NodeIt ItemIt; - typedef typename NodeNotifierIndicator::Type ItemNotifier; + typedef typename NodeNotifierIndicator::Type ItemNotifier; - template - class Map : public Graph::template NodeMap<_Value> { + template + class Map : public GR::template NodeMap { + typedef typename GR::template NodeMap Parent; + public: - typedef typename Graph::template NodeMap<_Value> Parent; - typedef typename Graph::template NodeMap<_Value> Type; + typedef typename GR::template NodeMap Type; typedef typename Parent::Value Value; - Map(const Graph& _digraph) : Parent(_digraph) {} - Map(const Graph& _digraph, const Value& _value) + Map(const GR& _digraph) : Parent(_digraph) {} + Map(const GR& _digraph, const Value& _value) : Parent(_digraph, _value) {} }; }; - template + template struct ArcNotifierIndicator { typedef InvalidType Type; }; - template + template struct ArcNotifierIndicator< - Graph, - typename enable_if::type + GR, + typename enable_if::type > { - typedef typename Graph::ArcNotifier Type; + typedef typename GR::ArcNotifier Type; }; - template - class ItemSetTraits<_Graph, typename _Graph::Arc> { + template + class ItemSetTraits { public: - typedef _Graph Graph; + typedef GR Graph; + typedef GR Digraph; - typedef typename Graph::Arc Item; - typedef typename Graph::ArcIt ItemIt; + typedef typename GR::Arc Item; + typedef typename GR::ArcIt ItemIt; - typedef typename ArcNotifierIndicator::Type ItemNotifier; + typedef typename ArcNotifierIndicator::Type ItemNotifier; - template - class Map : public Graph::template ArcMap<_Value> { + template + class Map : public GR::template ArcMap { + typedef typename GR::template ArcMap Parent; + public: - typedef typename Graph::template ArcMap<_Value> Parent; - typedef typename Graph::template ArcMap<_Value> Type; + typedef typename GR::template ArcMap Type; typedef typename Parent::Value Value; - Map(const Graph& _digraph) : Parent(_digraph) {} - Map(const Graph& _digraph, const Value& _value) + Map(const GR& _digraph) : Parent(_digraph) {} + Map(const GR& _digraph, const Value& _value) : Parent(_digraph, _value) {} }; }; - template + template struct EdgeNotifierIndicator { typedef InvalidType Type; }; - template + template struct EdgeNotifierIndicator< - Graph, - typename enable_if::type + GR, + typename enable_if::type > { - typedef typename Graph::EdgeNotifier Type; + typedef typename GR::EdgeNotifier Type; }; - template - class ItemSetTraits<_Graph, typename _Graph::Edge> { + template + class ItemSetTraits { public: - typedef _Graph Graph; + typedef GR Graph; + typedef GR Digraph; - typedef typename Graph::Edge Item; - typedef typename Graph::EdgeIt ItemIt; + typedef typename GR::Edge Item; + typedef typename GR::EdgeIt ItemIt; - typedef typename EdgeNotifierIndicator::Type ItemNotifier; + typedef typename EdgeNotifierIndicator::Type ItemNotifier; - template - class Map : public Graph::template EdgeMap<_Value> { + template + class Map : public GR::template EdgeMap { + typedef typename GR::template EdgeMap Parent; + public: - typedef typename Graph::template EdgeMap<_Value> Parent; - typedef typename Graph::template EdgeMap<_Value> Type; + typedef typename GR::template EdgeMap Type; typedef typename Parent::Value Value; - Map(const Graph& _digraph) : Parent(_digraph) {} - Map(const Graph& _digraph, const Value& _value) + Map(const GR& _digraph) : Parent(_digraph) {} + Map(const GR& _digraph, const Value& _value) : Parent(_digraph, _value) {} }; @@ -204,67 +210,93 @@ // Indicators for the tags - template + template struct NodeNumTagIndicator { static const bool value = false; }; - template + template struct NodeNumTagIndicator< - Graph, - typename enable_if::type + GR, + typename enable_if::type > { static const bool value = true; }; - template + template + struct ArcNumTagIndicator { + static const bool value = false; + }; + + template + struct ArcNumTagIndicator< + GR, + typename enable_if::type + > { + static const bool value = true; + }; + + template struct EdgeNumTagIndicator { static const bool value = false; }; - template + template struct EdgeNumTagIndicator< - Graph, - typename enable_if::type + GR, + typename enable_if::type > { static const bool value = true; }; - template + template + struct FindArcTagIndicator { + static const bool value = false; + }; + + template + struct FindArcTagIndicator< + GR, + typename enable_if::type + > { + static const bool value = true; + }; + + template struct FindEdgeTagIndicator { static const bool value = false; }; - template + template struct FindEdgeTagIndicator< - Graph, - typename enable_if::type + GR, + typename enable_if::type > { static const bool value = true; }; - template + template struct UndirectedTagIndicator { static const bool value = false; }; - template + template struct UndirectedTagIndicator< - Graph, - typename enable_if::type + GR, + typename enable_if::type > { static const bool value = true; }; - template + template struct BuildTagIndicator { static const bool value = false; }; - template + template struct BuildTagIndicator< - Graph, - typename enable_if::type + GR, + typename enable_if::type > { static const bool value = true; };