Changeset 891:74589d20dbc3 in lemon-0.x for src/hugo/default_map.h
- Timestamp:
- 09/21/04 00:57:48 (20 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1199
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/hugo/default_map.h
r822 r891 30 30 */ 31 31 #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 \ 34 public: \ 35 \ 36 typedef DynMap<MapRegistry, Value> Parent; \ 37 \ 38 typedef typename MapRegistry::Graph Graph; \ 39 \ 40 DefaultMap() : Parent() {} \ 41 DefaultMap(const Graph& g, MapRegistry& r) : Parent(g, r) {} \ 42 DefaultMap(const Graph& g, MapRegistry& r, const Value& v) \ 43 : Parent(g, r, v) {} \ 44 DefaultMap(const DefaultMap& copy) \ 45 : Parent(static_cast<const Parent&>(copy)) {} \ 46 template <typename TT> \ 47 DefaultMap(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]; \ 54 54 } \ 55 \ 56 template <typename CMap> DefaultMap& operator=(const CMap& copy) { \ 57 MapImpl::operator=(copy); \ 58 return *this; \ 55 } \ 56 } \ 57 DefaultMap& operator=(const DefaultMap& copy) { \ 58 Parent::operator=(static_cast<const Parent&>(copy)); \ 59 return *this; \ 60 } \ 61 template <typename TT> \ 62 DefaultMap& 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]; \ 59 69 } \ 60 \ 61 }; 70 } \ 71 return *this; \ 72 } \ 73 }; 62 74 63 75
Note: See TracChangeset
for help on using the changeset viewer.