gravatar
kpeter (Peter Kovacs)
kpeter@inf.elte.hu
VS compatibility fix (#268)
0 2 0
default
2 files changed with 87 insertions and 81 deletions:
↑ Collapse diff ↑
Ignore white space 6 line context
... ...
@@ -20,135 +20,141 @@
20 20
#define LEMON_BITS_TRAITS_H
21 21

	
22 22
//\file
23 23
//\brief Traits for graphs and maps
24 24
//
25 25

	
26 26
#include <lemon/bits/enable_if.h>
27 27

	
28 28
namespace lemon {
29 29

	
30 30
  struct InvalidType {};
31 31

	
32
  template <typename _Graph, typename _Item>
32
  template <typename GR, typename _Item>
33 33
  class ItemSetTraits {};
34 34

	
35 35

	
36
  template <typename Graph, typename Enable = void>
36
  template <typename GR, typename Enable = void>
37 37
  struct NodeNotifierIndicator {
38 38
    typedef InvalidType Type;
39 39
  };
40
  template <typename Graph>
40
  template <typename GR>
41 41
  struct NodeNotifierIndicator<
42
    Graph,
43
    typename enable_if<typename Graph::NodeNotifier::Notifier, void>::type
42
    GR,
43
    typename enable_if<typename GR::NodeNotifier::Notifier, void>::type
44 44
  > {
45
    typedef typename Graph::NodeNotifier Type;
45
    typedef typename GR::NodeNotifier Type;
46 46
  };
47 47

	
48
  template <typename _Graph>
49
  class ItemSetTraits<_Graph, typename _Graph::Node> {
48
  template <typename GR>
49
  class ItemSetTraits<GR, typename GR::Node> {
50 50
  public:
51 51

	
52
    typedef _Graph Graph;
52
    typedef GR Graph;
53
    typedef GR Digraph;
53 54

	
54
    typedef typename Graph::Node Item;
55
    typedef typename Graph::NodeIt ItemIt;
55
    typedef typename GR::Node Item;
56
    typedef typename GR::NodeIt ItemIt;
56 57

	
57
    typedef typename NodeNotifierIndicator<Graph>::Type ItemNotifier;
58
    typedef typename NodeNotifierIndicator<GR>::Type ItemNotifier;
58 59

	
59
    template <typename _Value>
60
    class Map : public Graph::template NodeMap<_Value> {
60
    template <typename V>
61
    class Map : public GR::template NodeMap<V> {
62
      typedef typename GR::template NodeMap<V> Parent;
63

	
61 64
    public:
62
      typedef typename Graph::template NodeMap<_Value> Parent;
63
      typedef typename Graph::template NodeMap<_Value> Type;
65
      typedef typename GR::template NodeMap<V> Type;
64 66
      typedef typename Parent::Value Value;
65 67

	
66
      Map(const Graph& _digraph) : Parent(_digraph) {}
67
      Map(const Graph& _digraph, const Value& _value)
68
      Map(const GR& _digraph) : Parent(_digraph) {}
69
      Map(const GR& _digraph, const Value& _value)
68 70
        : Parent(_digraph, _value) {}
69 71

	
70 72
     };
71 73

	
72 74
  };
73 75

	
74
  template <typename Graph, typename Enable = void>
76
  template <typename GR, typename Enable = void>
75 77
  struct ArcNotifierIndicator {
76 78
    typedef InvalidType Type;
77 79
  };
78
  template <typename Graph>
80
  template <typename GR>
79 81
  struct ArcNotifierIndicator<
80
    Graph,
81
    typename enable_if<typename Graph::ArcNotifier::Notifier, void>::type
82
    GR,
83
    typename enable_if<typename GR::ArcNotifier::Notifier, void>::type
82 84
  > {
83
    typedef typename Graph::ArcNotifier Type;
85
    typedef typename GR::ArcNotifier Type;
84 86
  };
85 87

	
86
  template <typename _Graph>
87
  class ItemSetTraits<_Graph, typename _Graph::Arc> {
88
  template <typename GR>
89
  class ItemSetTraits<GR, typename GR::Arc> {
88 90
  public:
89 91

	
90
    typedef _Graph Graph;
92
    typedef GR Graph;
93
    typedef GR Digraph;
91 94

	
92
    typedef typename Graph::Arc Item;
93
    typedef typename Graph::ArcIt ItemIt;
95
    typedef typename GR::Arc Item;
96
    typedef typename GR::ArcIt ItemIt;
94 97

	
95
    typedef typename ArcNotifierIndicator<Graph>::Type ItemNotifier;
98
    typedef typename ArcNotifierIndicator<GR>::Type ItemNotifier;
96 99

	
97
    template <typename _Value>
98
    class Map : public Graph::template ArcMap<_Value> {
100
    template <typename V>
101
    class Map : public GR::template ArcMap<V> {
102
      typedef typename GR::template ArcMap<V> Parent;
103

	
99 104
    public:
100
      typedef typename Graph::template ArcMap<_Value> Parent;
101
      typedef typename Graph::template ArcMap<_Value> Type;
105
      typedef typename GR::template ArcMap<V> Type;
102 106
      typedef typename Parent::Value Value;
103 107

	
104
      Map(const Graph& _digraph) : Parent(_digraph) {}
105
      Map(const Graph& _digraph, const Value& _value)
108
      Map(const GR& _digraph) : Parent(_digraph) {}
109
      Map(const GR& _digraph, const Value& _value)
106 110
        : Parent(_digraph, _value) {}
107 111
    };
108 112

	
109 113
  };
110 114

	
111
  template <typename Graph, typename Enable = void>
115
  template <typename GR, typename Enable = void>
112 116
  struct EdgeNotifierIndicator {
113 117
    typedef InvalidType Type;
114 118
  };
115
  template <typename Graph>
119
  template <typename GR>
116 120
  struct EdgeNotifierIndicator<
117
    Graph,
118
    typename enable_if<typename Graph::EdgeNotifier::Notifier, void>::type
121
    GR,
122
    typename enable_if<typename GR::EdgeNotifier::Notifier, void>::type
119 123
  > {
120
    typedef typename Graph::EdgeNotifier Type;
124
    typedef typename GR::EdgeNotifier Type;
121 125
  };
122 126

	
123
  template <typename _Graph>
124
  class ItemSetTraits<_Graph, typename _Graph::Edge> {
127
  template <typename GR>
128
  class ItemSetTraits<GR, typename GR::Edge> {
125 129
  public:
126 130

	
127
    typedef _Graph Graph;
131
    typedef GR Graph;
132
    typedef GR Digraph;
128 133

	
129
    typedef typename Graph::Edge Item;
130
    typedef typename Graph::EdgeIt ItemIt;
134
    typedef typename GR::Edge Item;
135
    typedef typename GR::EdgeIt ItemIt;
131 136

	
132
    typedef typename EdgeNotifierIndicator<Graph>::Type ItemNotifier;
137
    typedef typename EdgeNotifierIndicator<GR>::Type ItemNotifier;
133 138

	
134
    template <typename _Value>
135
    class Map : public Graph::template EdgeMap<_Value> {
139
    template <typename V>
140
    class Map : public GR::template EdgeMap<V> {
141
      typedef typename GR::template EdgeMap<V> Parent;
142

	
136 143
    public:
137
      typedef typename Graph::template EdgeMap<_Value> Parent;
138
      typedef typename Graph::template EdgeMap<_Value> Type;
144
      typedef typename GR::template EdgeMap<V> Type;
139 145
      typedef typename Parent::Value Value;
140 146

	
141
      Map(const Graph& _digraph) : Parent(_digraph) {}
142
      Map(const Graph& _digraph, const Value& _value)
147
      Map(const GR& _digraph) : Parent(_digraph) {}
148
      Map(const GR& _digraph, const Value& _value)
143 149
        : Parent(_digraph, _value) {}
144 150
    };
145 151

	
146 152
  };
147 153

	
148 154
  template <typename Map, typename Enable = void>
149 155
  struct MapTraits {
150 156
    typedef False ReferenceMapTag;
151 157

	
152 158
    typedef typename Map::Key Key;
153 159
    typedef typename Map::Value Value;
154 160

	
... ...
@@ -195,106 +201,106 @@
195 201
    typedef typename MatrixMap::SecondKey SecondKey;
196 202
    typedef typename MatrixMap::Value Value;
197 203

	
198 204
    typedef typename MatrixMap::ConstReference ConstReturnValue;
199 205
    typedef typename MatrixMap::Reference ReturnValue;
200 206

	
201 207
    typedef typename MatrixMap::ConstReference ConstReference;
202 208
    typedef typename MatrixMap::Reference Reference;
203 209
 };
204 210

	
205 211
  // Indicators for the tags
206 212

	
207
  template <typename Graph, typename Enable = void>
213
  template <typename GR, typename Enable = void>
208 214
  struct NodeNumTagIndicator {
209 215
    static const bool value = false;
210 216
  };
211 217

	
212
  template <typename Graph>
218
  template <typename GR>
213 219
  struct NodeNumTagIndicator<
214
    Graph,
215
    typename enable_if<typename Graph::NodeNumTag, void>::type
220
    GR,
221
    typename enable_if<typename GR::NodeNumTag, void>::type
216 222
  > {
217 223
    static const bool value = true;
218 224
  };
219 225

	
220
  template <typename Graph, typename Enable = void>
226
  template <typename GR, typename Enable = void>
221 227
  struct ArcNumTagIndicator {
222 228
    static const bool value = false;
223 229
  };
224 230

	
225
  template <typename Graph>
231
  template <typename GR>
226 232
  struct ArcNumTagIndicator<
227
    Graph,
228
    typename enable_if<typename Graph::ArcNumTag, void>::type
233
    GR,
234
    typename enable_if<typename GR::ArcNumTag, void>::type
229 235
  > {
230 236
    static const bool value = true;
231 237
  };
232 238

	
233
  template <typename Graph, typename Enable = void>
239
  template <typename GR, typename Enable = void>
234 240
  struct EdgeNumTagIndicator {
235 241
    static const bool value = false;
236 242
  };
237 243

	
238
  template <typename Graph>
244
  template <typename GR>
239 245
  struct EdgeNumTagIndicator<
240
    Graph,
241
    typename enable_if<typename Graph::EdgeNumTag, void>::type
246
    GR,
247
    typename enable_if<typename GR::EdgeNumTag, void>::type
242 248
  > {
243 249
    static const bool value = true;
244 250
  };
245 251

	
246
  template <typename Graph, typename Enable = void>
252
  template <typename GR, typename Enable = void>
247 253
  struct FindArcTagIndicator {
248 254
    static const bool value = false;
249 255
  };
250 256

	
251
  template <typename Graph>
257
  template <typename GR>
252 258
  struct FindArcTagIndicator<
253
    Graph,
254
    typename enable_if<typename Graph::FindArcTag, void>::type
259
    GR,
260
    typename enable_if<typename GR::FindArcTag, void>::type
255 261
  > {
256 262
    static const bool value = true;
257 263
  };
258 264

	
259
  template <typename Graph, typename Enable = void>
265
  template <typename GR, typename Enable = void>
260 266
  struct FindEdgeTagIndicator {
261 267
    static const bool value = false;
262 268
  };
263 269

	
264
  template <typename Graph>
270
  template <typename GR>
265 271
  struct FindEdgeTagIndicator<
266
    Graph,
267
    typename enable_if<typename Graph::FindEdgeTag, void>::type
272
    GR,
273
    typename enable_if<typename GR::FindEdgeTag, void>::type
268 274
  > {
269 275
    static const bool value = true;
270 276
  };
271 277

	
272
  template <typename Graph, typename Enable = void>
278
  template <typename GR, typename Enable = void>
273 279
  struct UndirectedTagIndicator {
274 280
    static const bool value = false;
275 281
  };
276 282

	
277
  template <typename Graph>
283
  template <typename GR>
278 284
  struct UndirectedTagIndicator<
279
    Graph,
280
    typename enable_if<typename Graph::UndirectedTag, void>::type
285
    GR,
286
    typename enable_if<typename GR::UndirectedTag, void>::type
281 287
  > {
282 288
    static const bool value = true;
283 289
  };
284 290

	
285
  template <typename Graph, typename Enable = void>
291
  template <typename GR, typename Enable = void>
286 292
  struct BuildTagIndicator {
287 293
    static const bool value = false;
288 294
  };
289 295

	
290
  template <typename Graph>
296
  template <typename GR>
291 297
  struct BuildTagIndicator<
292
    Graph,
293
    typename enable_if<typename Graph::BuildTag, void>::type
298
    GR,
299
    typename enable_if<typename GR::BuildTag, void>::type
294 300
  > {
295 301
    static const bool value = true;
296 302
  };
297 303

	
298 304
}
299 305

	
300 306
#endif
Ignore white space 24 line context
... ...
@@ -711,25 +711,25 @@
711 711
    .boolOption("dela", "Delaunay triangulation digraph")
712 712
    .optionGroup("alg","dela")
713 713
    .onlyOneGroup("alg")
714 714
    .boolOption("rand", "Use time seed for random number generator")
715 715
    .optionGroup("rand", "rand")
716 716
    .intOption("seed", "Random seed", -1)
717 717
    .optionGroup("rand", "seed")
718 718
    .onlyOneGroup("rand")
719 719
    .other("[prefix]","Prefix of the output files. Default is 'lgf-gen-out'")
720 720
    .run();
721 721

	
722 722
  if (ap["rand"]) {
723
    int seed = time(0);
723
    int seed = int(time(0));
724 724
    std::cout << "Random number seed: " << seed << std::endl;
725 725
    rnd = Random(seed);
726 726
  }
727 727
  if (ap.given("seed")) {
728 728
    int seed = ap["seed"];
729 729
    std::cout << "Random number seed: " << seed << std::endl;
730 730
    rnd = Random(seed);
731 731
  }
732 732

	
733 733
  std::string prefix;
734 734
  switch(ap.files().size())
735 735
    {
0 comments (0 inline)