Changeset 1990:15fb7a4ea6be in lemon-0.x for lemon/iterable_maps.h
- Timestamp:
- 03/01/06 11:17:25 (18 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2592
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/iterable_maps.h
r1956 r1990 20 20 #include <lemon/invalid.h> 21 21 22 #include <lemon/bits/default_map.h> 23 22 24 #include <vector> 23 25 #include <map> … … 48 50 /// \param _Item One of the graph's item type, the key of the map. 49 51 template <typename _Graph, typename _Item> 50 class IterableBoolMap 51 : protected ItemSetTraits<_Graph, _Item>::template Map<int>::Parent { 52 class IterableBoolMap : protected DefaultMap<_Graph, _Item, int> { 52 53 private: 53 54 typedef _Graph Graph; 54 55 55 56 typedef typename ItemSetTraits<Graph, _Item>::ItemIt KeyIt; 56 typedef typename ItemSetTraits<Graph, _Item> 57 ::template Map<int>::Parent Parent; 57 typedef DefaultMap<_Graph, _Item, int> Parent; 58 58 59 59 std::vector<_Item> array; … … 400 400 /// \param _Item One of the graph's item type, the key of the map. 401 401 template <typename _Graph, typename _Item> 402 class IterableIntMap : protected ItemSetTraits<_Graph, _Item> 403 ::template Map<_iterable_maps_bits::IterableIntMapNode<_Item> >::Parent { 402 class IterableIntMap 403 : protected DefaultMap<_Graph, _Item, _iterable_maps_bits:: 404 IterableIntMapNode<_Item> > { 404 405 public: 405 typedef typename ItemSetTraits<_Graph, _Item>406 ::template Map<_iterable_maps_bits::IterableIntMapNode<_Item> >407 ::ParentParent;406 typedef DefaultMap<_Graph, _Item, _iterable_maps_bits:: 407 IterableIntMapNode<_Item> > 408 Parent; 408 409 409 410 /// The key type … … 688 689 /// \param _Value Any comparable value type. 689 690 template <typename _Graph, typename _Item, typename _Value> 690 class IterableValueMap : protected ItemSetTraits<_Graph, _Item>691 ::template Map<_iterable_maps_bits::IterableValueMapNode<_Item, _Value> >692 ::Parent{691 class IterableValueMap 692 : protected DefaultMap<_Graph, _Item, _iterable_maps_bits:: 693 IterableValueMapNode<_Item, _Value> > { 693 694 public: 694 typedef typename ItemSetTraits<_Graph, _Item> 695 ::template Map<_iterable_maps_bits::IterableValueMapNode<_Item, _Value> > 696 ::Parent Parent; 695 typedef DefaultMap<_Graph, _Item, _iterable_maps_bits:: 696 IterableValueMapNode<_Item, _Value> > Parent; 697 697 698 698 /// The key type … … 703 703 typedef _Graph Graph; 704 704 705 protected: 706 707 typedef typename ItemSetTraits<_Graph, Key>::ItemIt KeyIt; 708 709 public: 710 705 711 /// \brief Constructor of the Map with a given value. 706 712 /// … … 708 714 explicit IterableValueMap(const Graph& graph, 709 715 const Value& value = Value()) 710 : Parent(graph, _iterable_maps_bits:: IterableValueMapNode<_Item,711 _Value>(value)) {712 for ( typename Parent::ItemIt it(*this); it != INVALID; ++it) {716 : Parent(graph, _iterable_maps_bits:: 717 IterableValueMapNode<_Item, _Value>(value)) { 718 for (KeyIt it(*Parent::getGraph()); it != INVALID; ++it) { 713 719 lace(it); 714 720 } 715 721 } 716 722 717 pr ivate:723 protected: 718 724 719 725 void unlace(const Key& key) { … … 872 878 protected: 873 879 880 virtual void add(const Key& key) { 881 Parent::add(key); 882 unlace(key); 883 } 884 885 virtual void add(const std::vector<Key>& keys) { 886 Parent::add(keys); 887 for (int i = 0; i < (int)keys.size(); ++i) { 888 lace(keys[i]); 889 } 890 } 891 874 892 virtual void erase(const Key& key) { 875 893 unlace(key); … … 884 902 } 885 903 904 virtual void build() { 905 Parent::build(); 906 for (KeyIt it(*Parent::getGraph()); it != INVALID; ++it) { 907 lace(it); 908 } 909 } 910 886 911 virtual void clear() { 887 912 first.clear();
Note: See TracChangeset
for help on using the changeset viewer.