Changeset 1267:a93f94dbe3d3 in lemon-0.x for src/lemon/map_utils.h
- Timestamp:
- 03/26/05 00:31:57 (20 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1694
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/lemon/map_utils.h
r1239 r1267 26 26 #include <vector> 27 27 28 #include <lemon/graph_utils.h> 29 28 30 namespace lemon { 29 31 30 32 /// \addtogroup mutils 31 33 /// @{ 34 35 36 template <typename Map, typename Enable = void> 37 struct ReferenceMapTraits { 38 typedef typename Map::Value Value; 39 typedef typename Map::Value& Reference; 40 typedef const typename Map::Value& ConstReference; 41 typedef typename Map::Value* Pointer; 42 typedef const typename Map::Value* ConstPointer; 43 }; 44 45 template <typename Map> 46 struct ReferenceMapTraits< 47 Map, 48 typename enable_if<typename Map::FullTypeTag, void>::type 49 > { 50 typedef typename Map::Value Value; 51 typedef typename Map::Reference Reference; 52 typedef typename Map::ConstReference ConstReference; 53 typedef typename Map::Pointer Pointer; 54 typedef typename Map::ConstPointer ConstPointer; 55 }; 32 56 33 57 /// \brief General inversable map type. … … 40 64 /// \param _Map The map to extend with inversable functionality. 41 65 template < 42 typename _Graph, 43 typename _Map 66 typename _Graph, 67 typename _Item, 68 typename _Value, 69 typename _Map 70 = typename ItemSetTraits<_Graph, _Item>::template Map<_Value> 44 71 > 45 72 class InversableMap : protected _Map { 46 73 47 74 public: 75 76 typedef _Map Map; 48 77 typedef _Graph Graph; 49 50 typedef _Map Map; 51 /// The key type of InversableMap (Node, Edge, UndirEdge). 78 /// The key type of InversableMap (Node, Edge, UndirEdge). 52 79 typedef typename _Map::Key Key; 53 80 /// The value type of the InversableMap. 54 81 typedef typename _Map::Value Value; 82 55 83 typedef std::map<Value, Key> InverseMap; 56 84 … … 65 93 /// \brief The setter function of the map. 66 94 /// 67 /// It sets the map and the inverse map to given key-value pair. 95 68 96 void set(const Key& key, const Value& val) { 69 97 Value oldval = Map::operator[](key); … … 141 169 typename _Graph, 142 170 typename _Item, 143 typename _Map 171 typename _Map = typename ItemSetTraits<_Graph, _Item>::template Map<int> 144 172 > 145 173 class DescriptorMap : protected _Map { … … 238 266 typedef int Value; 239 267 typedef _Item Item; 268 typedef _Item Key; 240 269 241 270 /// \brief The class represents the inverse of the map.
Note: See TracChangeset
for help on using the changeset viewer.