Changes in lemon/bits/traits.h [663:f2d6d3446adf:314:2cc60866a0c9] in lemon
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/bits/traits.h
r663 r314 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-200 95 * Copyright (C) 2003-2008 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 30 30 struct InvalidType {}; 31 31 32 template <typename GR, typename _Item>32 template <typename _Graph, typename _Item> 33 33 class ItemSetTraits {}; 34 34 35 35 36 template <typename G R, typename Enable = void>36 template <typename Graph, typename Enable = void> 37 37 struct NodeNotifierIndicator { 38 38 typedef InvalidType Type; 39 39 }; 40 template <typename G R>40 template <typename Graph> 41 41 struct NodeNotifierIndicator< 42 G R,43 typename enable_if<typename G R::NodeNotifier::Notifier, void>::type44 > { 45 typedef typename G R::NodeNotifier Type;46 }; 47 48 template <typename GR>49 class ItemSetTraits< GR, typename GR::Node> {42 Graph, 43 typename enable_if<typename Graph::NodeNotifier::Notifier, void>::type 44 > { 45 typedef typename Graph::NodeNotifier Type; 46 }; 47 48 template <typename _Graph> 49 class ItemSetTraits<_Graph, typename _Graph::Node> { 50 50 public: 51 51 52 typedef GR Graph; 53 typedef GR Digraph; 54 55 typedef typename GR::Node Item; 56 typedef typename GR::NodeIt ItemIt; 57 58 typedef typename NodeNotifierIndicator<GR>::Type ItemNotifier; 59 60 template <typename V> 61 class Map : public GR::template NodeMap<V> { 62 typedef typename GR::template NodeMap<V> Parent; 63 52 typedef _Graph Graph; 53 54 typedef typename Graph::Node Item; 55 typedef typename Graph::NodeIt ItemIt; 56 57 typedef typename NodeNotifierIndicator<Graph>::Type ItemNotifier; 58 59 template <typename _Value> 60 class Map : public Graph::template NodeMap<_Value> { 64 61 public: 65 typedef typename GR::template NodeMap<V> Type; 62 typedef typename Graph::template NodeMap<_Value> Parent; 63 typedef typename Graph::template NodeMap<_Value> Type; 66 64 typedef typename Parent::Value Value; 67 65 68 Map(const G R& _digraph) : Parent(_digraph) {}69 Map(const G R& _digraph, const Value& _value)66 Map(const Graph& _digraph) : Parent(_digraph) {} 67 Map(const Graph& _digraph, const Value& _value) 70 68 : Parent(_digraph, _value) {} 71 69 … … 74 72 }; 75 73 76 template <typename G R, typename Enable = void>74 template <typename Graph, typename Enable = void> 77 75 struct ArcNotifierIndicator { 78 76 typedef InvalidType Type; 79 77 }; 80 template <typename G R>78 template <typename Graph> 81 79 struct ArcNotifierIndicator< 82 G R,83 typename enable_if<typename G R::ArcNotifier::Notifier, void>::type84 > { 85 typedef typename G R::ArcNotifier Type;86 }; 87 88 template <typename GR>89 class ItemSetTraits< GR, typename GR::Arc> {80 Graph, 81 typename enable_if<typename Graph::ArcNotifier::Notifier, void>::type 82 > { 83 typedef typename Graph::ArcNotifier Type; 84 }; 85 86 template <typename _Graph> 87 class ItemSetTraits<_Graph, typename _Graph::Arc> { 90 88 public: 91 89 92 typedef GR Graph; 93 typedef GR Digraph; 94 95 typedef typename GR::Arc Item; 96 typedef typename GR::ArcIt ItemIt; 97 98 typedef typename ArcNotifierIndicator<GR>::Type ItemNotifier; 99 100 template <typename V> 101 class Map : public GR::template ArcMap<V> { 102 typedef typename GR::template ArcMap<V> Parent; 103 90 typedef _Graph Graph; 91 92 typedef typename Graph::Arc Item; 93 typedef typename Graph::ArcIt ItemIt; 94 95 typedef typename ArcNotifierIndicator<Graph>::Type ItemNotifier; 96 97 template <typename _Value> 98 class Map : public Graph::template ArcMap<_Value> { 104 99 public: 105 typedef typename GR::template ArcMap<V> Type; 100 typedef typename Graph::template ArcMap<_Value> Parent; 101 typedef typename Graph::template ArcMap<_Value> Type; 106 102 typedef typename Parent::Value Value; 107 103 108 Map(const G R& _digraph) : Parent(_digraph) {}109 Map(const G R& _digraph, const Value& _value)104 Map(const Graph& _digraph) : Parent(_digraph) {} 105 Map(const Graph& _digraph, const Value& _value) 110 106 : Parent(_digraph, _value) {} 111 107 }; … … 113 109 }; 114 110 115 template <typename G R, typename Enable = void>111 template <typename Graph, typename Enable = void> 116 112 struct EdgeNotifierIndicator { 117 113 typedef InvalidType Type; 118 114 }; 119 template <typename G R>115 template <typename Graph> 120 116 struct EdgeNotifierIndicator< 121 G R,122 typename enable_if<typename G R::EdgeNotifier::Notifier, void>::type123 > { 124 typedef typename G R::EdgeNotifier Type;125 }; 126 127 template <typename GR>128 class ItemSetTraits< GR, typename GR::Edge> {117 Graph, 118 typename enable_if<typename Graph::EdgeNotifier::Notifier, void>::type 119 > { 120 typedef typename Graph::EdgeNotifier Type; 121 }; 122 123 template <typename _Graph> 124 class ItemSetTraits<_Graph, typename _Graph::Edge> { 129 125 public: 130 126 131 typedef GR Graph; 132 typedef GR Digraph; 133 134 typedef typename GR::Edge Item; 135 typedef typename GR::EdgeIt ItemIt; 136 137 typedef typename EdgeNotifierIndicator<GR>::Type ItemNotifier; 138 139 template <typename V> 140 class Map : public GR::template EdgeMap<V> { 141 typedef typename GR::template EdgeMap<V> Parent; 142 127 typedef _Graph Graph; 128 129 typedef typename Graph::Edge Item; 130 typedef typename Graph::EdgeIt ItemIt; 131 132 typedef typename EdgeNotifierIndicator<Graph>::Type ItemNotifier; 133 134 template <typename _Value> 135 class Map : public Graph::template EdgeMap<_Value> { 143 136 public: 144 typedef typename GR::template EdgeMap<V> Type; 137 typedef typename Graph::template EdgeMap<_Value> Parent; 138 typedef typename Graph::template EdgeMap<_Value> Type; 145 139 typedef typename Parent::Value Value; 146 140 147 Map(const G R& _digraph) : Parent(_digraph) {}148 Map(const G R& _digraph, const Value& _value)141 Map(const Graph& _digraph) : Parent(_digraph) {} 142 Map(const Graph& _digraph, const Value& _value) 149 143 : Parent(_digraph, _value) {} 150 144 }; … … 211 205 // Indicators for the tags 212 206 213 template <typename G R, typename Enable = void>207 template <typename Graph, typename Enable = void> 214 208 struct NodeNumTagIndicator { 215 209 static const bool value = false; 216 210 }; 217 211 218 template <typename G R>212 template <typename Graph> 219 213 struct NodeNumTagIndicator< 220 GR, 221 typename enable_if<typename GR::NodeNumTag, void>::type 222 > { 223 static const bool value = true; 224 }; 225 226 template <typename GR, typename Enable = void> 227 struct ArcNumTagIndicator { 228 static const bool value = false; 229 }; 230 231 template <typename GR> 232 struct ArcNumTagIndicator< 233 GR, 234 typename enable_if<typename GR::ArcNumTag, void>::type 235 > { 236 static const bool value = true; 237 }; 238 239 template <typename GR, typename Enable = void> 214 Graph, 215 typename enable_if<typename Graph::NodeNumTag, void>::type 216 > { 217 static const bool value = true; 218 }; 219 220 template <typename Graph, typename Enable = void> 240 221 struct EdgeNumTagIndicator { 241 222 static const bool value = false; 242 223 }; 243 224 244 template <typename G R>225 template <typename Graph> 245 226 struct EdgeNumTagIndicator< 246 GR, 247 typename enable_if<typename GR::EdgeNumTag, void>::type 248 > { 249 static const bool value = true; 250 }; 251 252 template <typename GR, typename Enable = void> 253 struct FindArcTagIndicator { 254 static const bool value = false; 255 }; 256 257 template <typename GR> 258 struct FindArcTagIndicator< 259 GR, 260 typename enable_if<typename GR::FindArcTag, void>::type 261 > { 262 static const bool value = true; 263 }; 264 265 template <typename GR, typename Enable = void> 227 Graph, 228 typename enable_if<typename Graph::EdgeNumTag, void>::type 229 > { 230 static const bool value = true; 231 }; 232 233 template <typename Graph, typename Enable = void> 266 234 struct FindEdgeTagIndicator { 267 235 static const bool value = false; 268 236 }; 269 237 270 template <typename G R>238 template <typename Graph> 271 239 struct FindEdgeTagIndicator< 272 G R,273 typename enable_if<typename G R::FindEdgeTag, void>::type274 > { 275 static const bool value = true; 276 }; 277 278 template <typename G R, typename Enable = void>240 Graph, 241 typename enable_if<typename Graph::FindEdgeTag, void>::type 242 > { 243 static const bool value = true; 244 }; 245 246 template <typename Graph, typename Enable = void> 279 247 struct UndirectedTagIndicator { 280 248 static const bool value = false; 281 249 }; 282 250 283 template <typename G R>251 template <typename Graph> 284 252 struct UndirectedTagIndicator< 285 G R,286 typename enable_if<typename G R::UndirectedTag, void>::type287 > { 288 static const bool value = true; 289 }; 290 291 template <typename G R, typename Enable = void>253 Graph, 254 typename enable_if<typename Graph::UndirectedTag, void>::type 255 > { 256 static const bool value = true; 257 }; 258 259 template <typename Graph, typename Enable = void> 292 260 struct BuildTagIndicator { 293 261 static const bool value = false; 294 262 }; 295 263 296 template <typename G R>264 template <typename Graph> 297 265 struct BuildTagIndicator< 298 G R,299 typename enable_if<typename G R::BuildTag, void>::type266 Graph, 267 typename enable_if<typename Graph::BuildTag, void>::type 300 268 > { 301 269 static const bool value = true;
Note: See TracChangeset
for help on using the changeset viewer.