Changeset 1007:a7d5fe18d8f9 in lemon0.x for src/work/marci/merge_node_graph_wrapper.h
 Timestamp:
 11/18/04 15:37:22 (16 years ago)
 Branch:
 default
 Phase:
 public
 Convert:
 svn:c9d7d8f590d60310b91f818b3a526b0e/lemon/trunk@1397
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

src/work/marci/merge_node_graph_wrapper.h
r1002 r1007 24 24 #include <iostream> 25 25 26 #include <boost/type_traits.hpp> 27 #include <boost/utility/enable_if.hpp> 28 26 29 namespace lemon { 30 31 template <class _Graph1> 32 class P1 : public GraphWrapperBase<_Graph1> { 33 }; 34 35 template <class _Graph2> 36 class P2 : public GraphWrapperBase<_Graph2> { 37 }; 27 38 28 39 template <typename _Graph1, typename _Graph2, typename Enable=void> 29 40 class MergeNodeGraphWrapperBase : 30 public GraphWrapperBase<_Graph1>, public GraphWrapperBase<_Graph2> { 31 public: 32 typedef _Graph1 Graph1; 33 typedef _Graph2 Graph2; 34 typedef GraphWrapperBase<_Graph1> Parent1; 35 typedef GraphWrapperBase<_Graph2> Parent2; 41 public P1<_Graph1>, public P2<_Graph2> { 42 public: 43 void print() const { std::cout << "generic" << std::endl; } 44 typedef _Graph1 Graph1; 45 typedef _Graph2 Graph2; 46 typedef P1<_Graph1> Parent1; 47 typedef P2<_Graph2> Parent2; 36 48 typedef typename Parent1::Node Graph1Node; 37 49 typedef typename Parent2::Node Graph2Node; … … 150 162 }; 151 163 164 template <typename _Graph1, typename _Graph2> 165 class MergeNodeGraphWrapperBase< 166 _Graph1, _Graph2, typename boost::enable_if< 167 boost::is_same<typename _Graph1::Node, typename _Graph2::Node> >::type> : 168 public P1<_Graph1>, public P2<_Graph2> { 169 public : 170 void print() const { std::cout << "same" << std::endl; } 171 typedef _Graph1 Graph1; 172 typedef _Graph2 Graph2; 173 typedef P1<_Graph1> Parent1; 174 typedef P2<_Graph2> Parent2; 175 typedef typename Parent1::Node Graph1Node; 176 typedef typename Parent2::Node Graph2Node; 177 protected: 178 MergeNodeGraphWrapperBase() { } 179 public: 180 class Node { }; 181 class Edge { }; 182 void first() const; 183 void next() const; 184 }; 185 186 template <typename _Graph1, typename _Graph2> 187 class MergeNodeGraphWrapperBase< 188 _Graph1, _Graph2, typename boost::enable_if< 189 boost::is_base_and_derived<typename _Graph1::Node, typename _Graph2::Node> >::type> : 190 public P1<_Graph1>, public P2<_Graph2> { 191 public : 192 void print() const { std::cout << "2. nagyobb" << std::endl; } 193 typedef _Graph1 Graph1; 194 typedef _Graph2 Graph2; 195 typedef P1<_Graph1> Parent1; 196 typedef P2<_Graph2> Parent2; 197 typedef typename Parent1::Node Graph1Node; 198 typedef typename Parent2::Node Graph2Node; 199 protected: 200 MergeNodeGraphWrapperBase() { } 201 public: 202 class Node { }; 203 class Edge { }; 204 void first() const; 205 void next() const; 206 }; 207 208 template <typename _Graph1, typename _Graph2> 209 class MergeNodeGraphWrapperBase< 210 _Graph1, _Graph2, typename boost::enable_if< 211 boost::is_base_and_derived<typename _Graph2::Node, typename _Graph1::Node> >::type> : 212 public P1<_Graph1>, public P2<_Graph2> { 213 public : 214 void print() const { std::cout << "1. nagyobb" << std::endl; } 215 typedef _Graph1 Graph1; 216 typedef _Graph2 Graph2; 217 typedef P1<_Graph1> Parent1; 218 typedef P2<_Graph2> Parent2; 219 typedef typename Parent1::Node Graph1Node; 220 typedef typename Parent2::Node Graph2Node; 221 protected: 222 MergeNodeGraphWrapperBase() { } 223 public: 224 class Node { }; 225 class Edge { }; 226 void first() const; 227 void next() const; 228 }; 229 152 230 153 231 template <typename _Graph1, typename _Graph2, typename Enable=void>
Note: See TracChangeset
for help on using the changeset viewer.