COIN-OR::LEMON - Graph Library

Changeset 891:74589d20dbc3 in lemon-0.x for src/hugo/map_defines.h


Ignore:
Timestamp:
09/21/04 00:57:48 (20 years ago)
Author:
Balazs Dezso
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1199
Message:

template<typename CMap> Map(const CMap&) like constructors and
assigns are removed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/hugo/map_defines.h

    r877 r891  
    3939template <typename Value> \
    4040class NodeMap : public DynMap<NodeMapRegistry, Value> { \
    41 typedef DynMap<NodeMapRegistry, Value> MapImpl; \
    42 public: \
     41public: \
     42typedef DynMap<NodeMapRegistry, Value> Parent; \
    4343NodeMap() {} \
    44 NodeMap(const typename MapImpl::Graph& g) \
    45   : MapImpl(g, g.node_maps) {} \
    46 NodeMap(const typename MapImpl::Graph& g, const Value& v) \
    47   : MapImpl(g, g.node_maps, v) {} \
    48 NodeMap(const NodeMap& copy) : MapImpl(static_cast<const MapImpl&>(copy)) {} \
    49 template <typename CMap> NodeMap(const CMap& copy) : MapImpl(copy) {} \
     44NodeMap(const typename Parent::Graph& g) \
     45  : Parent(g, g.node_maps) {} \
     46NodeMap(const typename Parent::Graph& g, const Value& v) \
     47  : Parent(g, g.node_maps, v) {} \
     48NodeMap(const NodeMap& copy) : Parent(static_cast<const Parent&>(copy)) {} \
     49template <typename TT> \
     50NodeMap(const NodeMap<TT>& copy) \
     51  : Parent(static_cast<const typename NodeMap<TT>::Parent&>(copy)) {} \
    5052NodeMap& operator=(const NodeMap& copy) { \
    51   MapImpl::operator=(static_cast<const MapImpl&>(copy));\
    52   return *this; \
    53 } \
    54 template <typename CMap> NodeMap& operator=(const CMap& copy) { \
    55   MapImpl::operator=(copy);\
     53  Parent::operator=(static_cast<const Parent&>(copy));\
     54  return *this; \
     55} \
     56template <typename TT> \
     57NodeMap& operator=(const NodeMap<TT>& copy) { \
     58  Parent::operator=(static_cast<const typename NodeMap<TT>::Parent&>(copy));\
    5659  return *this; \
    5760} \
     
    6770template <typename Value> \
    6871class EdgeMap : public DynMap<EdgeMapRegistry, Value> { \
    69 typedef DynMap<EdgeMapRegistry, Value> MapImpl; \
    70 public: \
     72public: \
     73typedef DynMap<EdgeMapRegistry, Value> Parent; \
     74\
    7175EdgeMap() {} \
    72 EdgeMap(const typename MapImpl::Graph& g) \
    73   : MapImpl(g, g.edge_maps) {} \
    74 EdgeMap(const typename MapImpl::Graph& g, const Value& v) \
    75   : MapImpl(g, g.edge_maps, v) {} \
    76 EdgeMap(const EdgeMap& copy) : MapImpl(static_cast<const MapImpl&>(copy)) {} \
    77 template <typename CMap> EdgeMap(const CMap& copy) : MapImpl(copy) {} \
     76EdgeMap(const typename Parent::Graph& g) \
     77  : Parent(g, g.edge_maps) {} \
     78EdgeMap(const typename Parent::Graph& g, const Value& v) \
     79  : Parent(g, g.edge_maps, v) {} \
     80EdgeMap(const EdgeMap& copy) : Parent(static_cast<const Parent&>(copy)) {} \
     81template <typename TT> \
     82EdgeMap(const EdgeMap<TT>& copy) \
     83  : Parent(static_cast<const typename EdgeMap<TT>::Parent&>(copy)) {} \
    7884EdgeMap& operator=(const EdgeMap& copy) { \
    79   MapImpl::operator=(static_cast<const MapImpl&>(copy));\
    80   return *this; \
    81 } \
    82 template <typename CMap> EdgeMap& operator=(const CMap& copy) { \
    83   MapImpl::operator=(copy);\
     85  Parent::operator=(static_cast<const Parent&>(copy));\
     86  return *this; \
     87} \
     88template <typename TT> \
     89EdgeMap& operator=(const EdgeMap<TT>& copy) { \
     90  Parent::operator=(static_cast<const typename EdgeMap<TT>::Parent&>(copy));\
    8491  return *this; \
    8592} \
     
    109116template <typename Value> \
    110117class SymEdgeMap : public SymMap<DynMap, SymEdgeMapRegistry, Value> { \
    111   typedef SymMap<DynMap, SymEdgeMapRegistry, Value> MapImpl; \
    112  public: \
    113 \
    114   SymEdgeMap() {} \
    115 \
    116   SymEdgeMap(const typename MapImpl::Graph& g) \
    117     : MapImpl(g, g.sym_edge_maps) {} \
    118 \
    119   SymEdgeMap(const typename MapImpl::Graph& g, const Value& v) \
    120     : MapImpl(g, g.sym_edge_maps, v) {} \
    121 \
    122   SymEdgeMap(const SymEdgeMap& copy) \
    123     : MapImpl(static_cast<const MapImpl&>(copy)) {} \
    124 \
    125   template <typename CMap> SymEdgeMap(const CMap& copy) : MapImpl(copy) {} \
    126   SymEdgeMap& operator=(const SymEdgeMap& copy) { \
    127     MapImpl::operator=(static_cast<const MapImpl&>(copy));\
    128     return *this; \
    129   } \
    130 \
    131   template <typename CMap> SymEdgeMap& operator=(const CMap& copy) { \
    132     MapImpl::operator=(copy);\
    133     return *this; \
    134   } \
    135 };
    136 
     118public: \
     119typedef SymMap<DynMap, SymEdgeMapRegistry, Value> Parent; \
     120\
     121SymEdgeMap() {} \
     122SymEdgeMap(const typename Parent::Graph& g) \
     123  : Parent(g, g.sym_edge_maps) {} \
     124SymEdgeMap(const typename Parent::Graph& g, const Value& v) \
     125  : Parent(g, g.sym_edge_maps, v) {} \
     126SymEdgeMap(const SymEdgeMap& copy) \
     127  : Parent(static_cast<const Parent&>(copy)) {} \
     128template <typename TT> \
     129SymEdgeMap(const NodeMap<TT>& copy) \
     130  : Parent(static_cast<const typename SymEdgeMap<TT>::Parent&>(copy)) {} \
     131SymEdgeMap& operator=(const SymEdgeMap& copy) { \
     132  Parent::operator=(static_cast<const Parent&>(copy));\
     133  return *this; \
     134} \
     135template <typename TT> \
     136SymEdgeMap& operator=(const SymEdgeMap<TT>& copy) { \
     137  Parent::operator=(static_cast<const typename SymEdgeMap<TT>::Parent&>(copy));\
     138  return *this; \
     139} \
     140};
    137141
    138142/** This is a macro to import an node map into a graph class.
     
    140144#define IMPORT_NODE_MAP(From, from, To, to) \
    141145template <typename Value> \
    142 class NodeMap \
    143   : public From::template NodeMap<Value> { \
    144   typedef typename From::template NodeMap<Value> MapImpl; \
    145  public: \
    146    NodeMap() : MapImpl() {} \
    147 \
    148    NodeMap(const To& to) \
    149      : MapImpl(static_cast<const From&>(from)) { } \
    150 \
    151    NodeMap(const To& to, const Value& value) \
    152      : MapImpl(static_cast<const From&>(from), value) { } \
    153 \
    154    NodeMap(const NodeMap& copy) \
    155      : MapImpl(static_cast<const MapImpl&>(copy)) {} \
    156 \
    157    template<typename CMap> \
    158    NodeMap(const CMap& copy) \
    159      : MapImpl(copy) {} \
    160 \
    161    NodeMap& operator=(const NodeMap& copy) { \
    162      MapImpl::operator=(static_cast<const MapImpl&>(copy)); \
    163      return *this; \
    164    } \
    165 \
    166    template <typename CMap> \
    167    NodeMap& operator=(const CMap& copy) { \
    168      MapImpl::operator=(copy); \
    169      return *this; \
    170    } \
     146class NodeMap : public From::template NodeMap<Value> { \
     147\
     148public: \
     149typedef typename From::template NodeMap<Value> Parent; \
     150\
     151NodeMap() : Parent() {} \
     152NodeMap(const To& to) \
     153  : Parent(static_cast<const From&>(from)) { } \
     154NodeMap(const To& to, const Value& value) \
     155  : Parent(static_cast<const From&>(from), value) { } \
     156NodeMap(const NodeMap& copy) \
     157  : Parent(static_cast<const Parent&>(copy)) {} \
     158template <typename TT> \
     159NodeMap(const NodeMap<TT>& copy) \
     160  : Parent(static_cast<const typename NodeMap<TT>::Parent&>(copy)) {} \
     161NodeMap& operator=(const NodeMap& copy) { \
     162  Parent::operator=(static_cast<const Parent&>(copy)); \
     163  return *this; \
     164} \
     165template <typename TT> \
     166NodeMap& operator=(const NodeMap<TT>& copy) { \
     167  Parent::operator=(static_cast<const typename NodeMap<TT>::Parent&>(copy));\
     168  return *this; \
     169} \
    171170};
    172171
     
    175174#define IMPORT_EDGE_MAP(From, from, To, to) \
    176175template <typename Value> \
    177 class EdgeMap \
    178   : public From::template EdgeMap<Value> { \
    179   typedef typename From::template EdgeMap<Value> MapImpl; \
    180  public: \
    181    EdgeMap() : MapImpl() {} \
    182 \
    183    EdgeMap(const To& to) \
    184      : MapImpl(static_cast<const From&>(from)) { } \
    185 \
    186    EdgeMap(const To& to, const Value& value) \
    187      : MapImpl(static_cast<const From&>(from), value) { } \
    188 \
    189    EdgeMap(const EdgeMap& copy) \
    190      : MapImpl(static_cast<const MapImpl&>(copy)) {} \
    191 \
    192    template<typename CMap> \
    193    EdgeMap(const CMap& copy) \
    194      : MapImpl(copy) {} \
    195 \
    196    EdgeMap& operator=(const EdgeMap& copy) { \
    197      MapImpl::operator=(static_cast<const MapImpl&>(copy)); \
    198      return *this; \
    199    } \
    200 \
    201    template <typename CMap> \
    202    EdgeMap& operator=(const CMap& copy) { \
    203      MapImpl::operator=(copy); \
    204      return *this; \
    205    } \
     176class EdgeMap : public From::template EdgeMap<Value> { \
     177\
     178public: \
     179typedef typename From::template EdgeMap<Value> Parent; \
     180\
     181EdgeMap() : Parent() {} \
     182EdgeMap(const To& to) \
     183  : Parent(static_cast<const From&>(from)) { } \
     184EdgeMap(const To& to, const Value& value) \
     185  : Parent(static_cast<const From&>(from), value) { } \
     186EdgeMap(const EdgeMap& copy) \
     187  : Parent(static_cast<const Parent&>(copy)) {} \
     188template <typename TT> \
     189EdgeMap(const EdgeMap<TT>& copy) \
     190  : Parent(static_cast<const typename EdgeMap<TT>::Parent&>(copy)) {} \
     191EdgeMap& operator=(const EdgeMap& copy) { \
     192  Parent::operator=(static_cast<const Parent&>(copy)); \
     193  return *this; \
     194} \
     195template <typename TT> \
     196EdgeMap& operator=(const EdgeMap<TT>& copy) { \
     197  Parent::operator=(static_cast<const typename EdgeMap<TT>::Parent&>(copy));\
     198  return *this; \
     199} \
    206200};
    207201
Note: See TracChangeset for help on using the changeset viewer.