VS compatibility fix (#268)
authorPeter Kovacs <kpeter@inf.elte.hu>
Fri, 24 Apr 2009 10:15:33 +0200
changeset 663f2d6d3446adf
parent 659 0c8e5c688440
child 664 4137ef9aacc6
VS compatibility fix (#268)
lemon/bits/traits.h
tools/lgf-gen.cc
     1.1 --- a/lemon/bits/traits.h	Thu Apr 23 10:44:35 2009 +0100
     1.2 +++ b/lemon/bits/traits.h	Fri Apr 24 10:15:33 2009 +0200
     1.3 @@ -29,117 +29,123 @@
     1.4  
     1.5    struct InvalidType {};
     1.6  
     1.7 -  template <typename _Graph, typename _Item>
     1.8 +  template <typename GR, typename _Item>
     1.9    class ItemSetTraits {};
    1.10  
    1.11  
    1.12 -  template <typename Graph, typename Enable = void>
    1.13 +  template <typename GR, typename Enable = void>
    1.14    struct NodeNotifierIndicator {
    1.15      typedef InvalidType Type;
    1.16    };
    1.17 -  template <typename Graph>
    1.18 +  template <typename GR>
    1.19    struct NodeNotifierIndicator<
    1.20 -    Graph,
    1.21 -    typename enable_if<typename Graph::NodeNotifier::Notifier, void>::type
    1.22 +    GR,
    1.23 +    typename enable_if<typename GR::NodeNotifier::Notifier, void>::type
    1.24    > {
    1.25 -    typedef typename Graph::NodeNotifier Type;
    1.26 +    typedef typename GR::NodeNotifier Type;
    1.27    };
    1.28  
    1.29 -  template <typename _Graph>
    1.30 -  class ItemSetTraits<_Graph, typename _Graph::Node> {
    1.31 +  template <typename GR>
    1.32 +  class ItemSetTraits<GR, typename GR::Node> {
    1.33    public:
    1.34  
    1.35 -    typedef _Graph Graph;
    1.36 +    typedef GR Graph;
    1.37 +    typedef GR Digraph;
    1.38  
    1.39 -    typedef typename Graph::Node Item;
    1.40 -    typedef typename Graph::NodeIt ItemIt;
    1.41 +    typedef typename GR::Node Item;
    1.42 +    typedef typename GR::NodeIt ItemIt;
    1.43  
    1.44 -    typedef typename NodeNotifierIndicator<Graph>::Type ItemNotifier;
    1.45 +    typedef typename NodeNotifierIndicator<GR>::Type ItemNotifier;
    1.46  
    1.47 -    template <typename _Value>
    1.48 -    class Map : public Graph::template NodeMap<_Value> {
    1.49 +    template <typename V>
    1.50 +    class Map : public GR::template NodeMap<V> {
    1.51 +      typedef typename GR::template NodeMap<V> Parent;
    1.52 +
    1.53      public:
    1.54 -      typedef typename Graph::template NodeMap<_Value> Parent;
    1.55 -      typedef typename Graph::template NodeMap<_Value> Type;
    1.56 +      typedef typename GR::template NodeMap<V> Type;
    1.57        typedef typename Parent::Value Value;
    1.58  
    1.59 -      Map(const Graph& _digraph) : Parent(_digraph) {}
    1.60 -      Map(const Graph& _digraph, const Value& _value)
    1.61 +      Map(const GR& _digraph) : Parent(_digraph) {}
    1.62 +      Map(const GR& _digraph, const Value& _value)
    1.63          : Parent(_digraph, _value) {}
    1.64  
    1.65       };
    1.66  
    1.67    };
    1.68  
    1.69 -  template <typename Graph, typename Enable = void>
    1.70 +  template <typename GR, typename Enable = void>
    1.71    struct ArcNotifierIndicator {
    1.72      typedef InvalidType Type;
    1.73    };
    1.74 -  template <typename Graph>
    1.75 +  template <typename GR>
    1.76    struct ArcNotifierIndicator<
    1.77 -    Graph,
    1.78 -    typename enable_if<typename Graph::ArcNotifier::Notifier, void>::type
    1.79 +    GR,
    1.80 +    typename enable_if<typename GR::ArcNotifier::Notifier, void>::type
    1.81    > {
    1.82 -    typedef typename Graph::ArcNotifier Type;
    1.83 +    typedef typename GR::ArcNotifier Type;
    1.84    };
    1.85  
    1.86 -  template <typename _Graph>
    1.87 -  class ItemSetTraits<_Graph, typename _Graph::Arc> {
    1.88 +  template <typename GR>
    1.89 +  class ItemSetTraits<GR, typename GR::Arc> {
    1.90    public:
    1.91  
    1.92 -    typedef _Graph Graph;
    1.93 +    typedef GR Graph;
    1.94 +    typedef GR Digraph;
    1.95  
    1.96 -    typedef typename Graph::Arc Item;
    1.97 -    typedef typename Graph::ArcIt ItemIt;
    1.98 +    typedef typename GR::Arc Item;
    1.99 +    typedef typename GR::ArcIt ItemIt;
   1.100  
   1.101 -    typedef typename ArcNotifierIndicator<Graph>::Type ItemNotifier;
   1.102 +    typedef typename ArcNotifierIndicator<GR>::Type ItemNotifier;
   1.103  
   1.104 -    template <typename _Value>
   1.105 -    class Map : public Graph::template ArcMap<_Value> {
   1.106 +    template <typename V>
   1.107 +    class Map : public GR::template ArcMap<V> {
   1.108 +      typedef typename GR::template ArcMap<V> Parent;
   1.109 +
   1.110      public:
   1.111 -      typedef typename Graph::template ArcMap<_Value> Parent;
   1.112 -      typedef typename Graph::template ArcMap<_Value> Type;
   1.113 +      typedef typename GR::template ArcMap<V> Type;
   1.114        typedef typename Parent::Value Value;
   1.115  
   1.116 -      Map(const Graph& _digraph) : Parent(_digraph) {}
   1.117 -      Map(const Graph& _digraph, const Value& _value)
   1.118 +      Map(const GR& _digraph) : Parent(_digraph) {}
   1.119 +      Map(const GR& _digraph, const Value& _value)
   1.120          : Parent(_digraph, _value) {}
   1.121      };
   1.122  
   1.123    };
   1.124  
   1.125 -  template <typename Graph, typename Enable = void>
   1.126 +  template <typename GR, typename Enable = void>
   1.127    struct EdgeNotifierIndicator {
   1.128      typedef InvalidType Type;
   1.129    };
   1.130 -  template <typename Graph>
   1.131 +  template <typename GR>
   1.132    struct EdgeNotifierIndicator<
   1.133 -    Graph,
   1.134 -    typename enable_if<typename Graph::EdgeNotifier::Notifier, void>::type
   1.135 +    GR,
   1.136 +    typename enable_if<typename GR::EdgeNotifier::Notifier, void>::type
   1.137    > {
   1.138 -    typedef typename Graph::EdgeNotifier Type;
   1.139 +    typedef typename GR::EdgeNotifier Type;
   1.140    };
   1.141  
   1.142 -  template <typename _Graph>
   1.143 -  class ItemSetTraits<_Graph, typename _Graph::Edge> {
   1.144 +  template <typename GR>
   1.145 +  class ItemSetTraits<GR, typename GR::Edge> {
   1.146    public:
   1.147  
   1.148 -    typedef _Graph Graph;
   1.149 +    typedef GR Graph;
   1.150 +    typedef GR Digraph;
   1.151  
   1.152 -    typedef typename Graph::Edge Item;
   1.153 -    typedef typename Graph::EdgeIt ItemIt;
   1.154 +    typedef typename GR::Edge Item;
   1.155 +    typedef typename GR::EdgeIt ItemIt;
   1.156  
   1.157 -    typedef typename EdgeNotifierIndicator<Graph>::Type ItemNotifier;
   1.158 +    typedef typename EdgeNotifierIndicator<GR>::Type ItemNotifier;
   1.159  
   1.160 -    template <typename _Value>
   1.161 -    class Map : public Graph::template EdgeMap<_Value> {
   1.162 +    template <typename V>
   1.163 +    class Map : public GR::template EdgeMap<V> {
   1.164 +      typedef typename GR::template EdgeMap<V> Parent;
   1.165 +
   1.166      public:
   1.167 -      typedef typename Graph::template EdgeMap<_Value> Parent;
   1.168 -      typedef typename Graph::template EdgeMap<_Value> Type;
   1.169 +      typedef typename GR::template EdgeMap<V> Type;
   1.170        typedef typename Parent::Value Value;
   1.171  
   1.172 -      Map(const Graph& _digraph) : Parent(_digraph) {}
   1.173 -      Map(const Graph& _digraph, const Value& _value)
   1.174 +      Map(const GR& _digraph) : Parent(_digraph) {}
   1.175 +      Map(const GR& _digraph, const Value& _value)
   1.176          : Parent(_digraph, _value) {}
   1.177      };
   1.178  
   1.179 @@ -204,93 +210,93 @@
   1.180  
   1.181    // Indicators for the tags
   1.182  
   1.183 -  template <typename Graph, typename Enable = void>
   1.184 +  template <typename GR, typename Enable = void>
   1.185    struct NodeNumTagIndicator {
   1.186      static const bool value = false;
   1.187    };
   1.188  
   1.189 -  template <typename Graph>
   1.190 +  template <typename GR>
   1.191    struct NodeNumTagIndicator<
   1.192 -    Graph,
   1.193 -    typename enable_if<typename Graph::NodeNumTag, void>::type
   1.194 +    GR,
   1.195 +    typename enable_if<typename GR::NodeNumTag, void>::type
   1.196    > {
   1.197      static const bool value = true;
   1.198    };
   1.199  
   1.200 -  template <typename Graph, typename Enable = void>
   1.201 +  template <typename GR, typename Enable = void>
   1.202    struct ArcNumTagIndicator {
   1.203      static const bool value = false;
   1.204    };
   1.205  
   1.206 -  template <typename Graph>
   1.207 +  template <typename GR>
   1.208    struct ArcNumTagIndicator<
   1.209 -    Graph,
   1.210 -    typename enable_if<typename Graph::ArcNumTag, void>::type
   1.211 +    GR,
   1.212 +    typename enable_if<typename GR::ArcNumTag, void>::type
   1.213    > {
   1.214      static const bool value = true;
   1.215    };
   1.216  
   1.217 -  template <typename Graph, typename Enable = void>
   1.218 +  template <typename GR, typename Enable = void>
   1.219    struct EdgeNumTagIndicator {
   1.220      static const bool value = false;
   1.221    };
   1.222  
   1.223 -  template <typename Graph>
   1.224 +  template <typename GR>
   1.225    struct EdgeNumTagIndicator<
   1.226 -    Graph,
   1.227 -    typename enable_if<typename Graph::EdgeNumTag, void>::type
   1.228 +    GR,
   1.229 +    typename enable_if<typename GR::EdgeNumTag, void>::type
   1.230    > {
   1.231      static const bool value = true;
   1.232    };
   1.233  
   1.234 -  template <typename Graph, typename Enable = void>
   1.235 +  template <typename GR, typename Enable = void>
   1.236    struct FindArcTagIndicator {
   1.237      static const bool value = false;
   1.238    };
   1.239  
   1.240 -  template <typename Graph>
   1.241 +  template <typename GR>
   1.242    struct FindArcTagIndicator<
   1.243 -    Graph,
   1.244 -    typename enable_if<typename Graph::FindArcTag, void>::type
   1.245 +    GR,
   1.246 +    typename enable_if<typename GR::FindArcTag, void>::type
   1.247    > {
   1.248      static const bool value = true;
   1.249    };
   1.250  
   1.251 -  template <typename Graph, typename Enable = void>
   1.252 +  template <typename GR, typename Enable = void>
   1.253    struct FindEdgeTagIndicator {
   1.254      static const bool value = false;
   1.255    };
   1.256  
   1.257 -  template <typename Graph>
   1.258 +  template <typename GR>
   1.259    struct FindEdgeTagIndicator<
   1.260 -    Graph,
   1.261 -    typename enable_if<typename Graph::FindEdgeTag, void>::type
   1.262 +    GR,
   1.263 +    typename enable_if<typename GR::FindEdgeTag, void>::type
   1.264    > {
   1.265      static const bool value = true;
   1.266    };
   1.267  
   1.268 -  template <typename Graph, typename Enable = void>
   1.269 +  template <typename GR, typename Enable = void>
   1.270    struct UndirectedTagIndicator {
   1.271      static const bool value = false;
   1.272    };
   1.273  
   1.274 -  template <typename Graph>
   1.275 +  template <typename GR>
   1.276    struct UndirectedTagIndicator<
   1.277 -    Graph,
   1.278 -    typename enable_if<typename Graph::UndirectedTag, void>::type
   1.279 +    GR,
   1.280 +    typename enable_if<typename GR::UndirectedTag, void>::type
   1.281    > {
   1.282      static const bool value = true;
   1.283    };
   1.284  
   1.285 -  template <typename Graph, typename Enable = void>
   1.286 +  template <typename GR, typename Enable = void>
   1.287    struct BuildTagIndicator {
   1.288      static const bool value = false;
   1.289    };
   1.290  
   1.291 -  template <typename Graph>
   1.292 +  template <typename GR>
   1.293    struct BuildTagIndicator<
   1.294 -    Graph,
   1.295 -    typename enable_if<typename Graph::BuildTag, void>::type
   1.296 +    GR,
   1.297 +    typename enable_if<typename GR::BuildTag, void>::type
   1.298    > {
   1.299      static const bool value = true;
   1.300    };
     2.1 --- a/tools/lgf-gen.cc	Thu Apr 23 10:44:35 2009 +0100
     2.2 +++ b/tools/lgf-gen.cc	Fri Apr 24 10:15:33 2009 +0200
     2.3 @@ -720,7 +720,7 @@
     2.4      .run();
     2.5  
     2.6    if (ap["rand"]) {
     2.7 -    int seed = time(0);
     2.8 +    int seed = int(time(0));
     2.9      std::cout << "Random number seed: " << seed << std::endl;
    2.10      rnd = Random(seed);
    2.11    }