COIN-OR::LEMON - Graph Library

Changeset 891:74589d20dbc3 in lemon-0.x for src/hugo/default_map.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/default_map.h

    r822 r891  
    3030   */
    3131#define DEFAULT_MAP_BODY(DynMap, Value) \
    32   { \
    33     typedef DynMap<MapRegistry, Value> MapImpl; \
    34   \
    35   public: \
    36   \
    37     typedef typename MapRegistry::Graph Graph; \
    38   \
    39     DefaultMap() : MapImpl() {} \
    40   \
    41     DefaultMap(const Graph& g, MapRegistry& r) : MapImpl(g, r) {} \
    42   \
    43     DefaultMap(const Graph& g, MapRegistry& r, const Value& v) \
    44       : MapImpl(g, r, v) {} \
    45   \
    46     DefaultMap(const DefaultMap& copy) \
    47       : MapImpl(static_cast<const MapImpl&>(copy)) {} \
    48   \
    49     template <typename CMap> DefaultMap(const CMap& copy) : MapImpl(copy) {} \
    50   \
    51     DefaultMap& operator=(const DefaultMap& copy) { \
    52       MapImpl::operator=(static_cast<const MapImpl&>(copy)); \
    53       return *this; \
     32{ \
     33\
     34public: \
     35\
     36typedef DynMap<MapRegistry, Value> Parent; \
     37\
     38typedef typename MapRegistry::Graph Graph; \
     39\
     40DefaultMap() : Parent() {} \
     41DefaultMap(const Graph& g, MapRegistry& r) : Parent(g, r) {} \
     42DefaultMap(const Graph& g, MapRegistry& r, const Value& v) \
     43  : Parent(g, r, v) {} \
     44DefaultMap(const DefaultMap& copy) \
     45  : Parent(static_cast<const Parent&>(copy)) {} \
     46template <typename TT> \
     47DefaultMap(const DefaultMap<MapRegistry, TT>& copy) { \
     48  Parent::MapBase::operator= \
     49    (static_cast<const typename Parent::MapBase&>(copy)); \
     50  if (Parent::getGraph()) { \
     51    for (typename Parent::KeyIt it(*Parent::getGraph()); it!=INVALID; ++it) {\
     52      Parent::add(it); \
     53      Parent::operator[](it) = copy[it]; \
    5454    } \
    55   \
    56     template <typename CMap> DefaultMap& operator=(const CMap& copy) { \
    57       MapImpl::operator=(copy); \
    58       return *this; \
     55  } \
     56} \
     57DefaultMap& operator=(const DefaultMap& copy) { \
     58  Parent::operator=(static_cast<const Parent&>(copy)); \
     59  return *this; \
     60} \
     61template <typename TT> \
     62DefaultMap& operator=(const DefaultMap<MapRegistry, TT>& copy) { \
     63  Parent::clear(); \
     64  Parent::MapBase::operator=(copy); \
     65  if (Parent::getGraph()) { \
     66    for (typename Parent::KeyIt it(*Parent::getGraph()); it!=INVALID; ++it) {\
     67      Parent::add(it); \
     68      Parent::operator[](it) = copy[it]; \
    5969    } \
    60   \
    61   };
     70  } \
     71  return *this; \
     72} \
     73};
    6274
    6375
Note: See TracChangeset for help on using the changeset viewer.