lemon/bits/vector_map.h
changeset 2181 b2c38f4f72ff
parent 1999 2ff283124dfc
child 2202 09cbc87cb4ab
equal deleted inserted replaced
14:e71478d66dc2 15:9a6725188625
    24 
    24 
    25 #include <lemon/bits/traits.h>
    25 #include <lemon/bits/traits.h>
    26 #include <lemon/bits/utility.h>
    26 #include <lemon/bits/utility.h>
    27 
    27 
    28 #include <lemon/bits/alteration_notifier.h>
    28 #include <lemon/bits/alteration_notifier.h>
       
    29 
       
    30 #include <lemon/concept_check.h>
       
    31 #include <lemon/concept/maps.h>
    29 
    32 
    30 ///\ingroup graphbits
    33 ///\ingroup graphbits
    31 ///
    34 ///
    32 ///\file
    35 ///\file
    33 ///\brief Vector based graph maps.
    36 ///\brief Vector based graph maps.
   110 	Parent::attach(*_copy.getNotifier());
   113 	Parent::attach(*_copy.getNotifier());
   111 	container = _copy.container;
   114 	container = _copy.container;
   112       }
   115       }
   113     }
   116     }
   114 
   117 
   115   private:
   118     /// \brief Assign operator.
   116 
   119     ///
   117     VectorMap& operator=(const VectorMap&);
   120     /// This operator assigns for each item in the map the
   118 
   121     /// value mapped to the same item in the copied map.  
       
   122     /// The parameter map should be indiced with the same
       
   123     /// itemset because this assign operator does not change
       
   124     /// the container of the map. 
       
   125     VectorMap& operator=(const VectorMap& cmap) {
       
   126       return operator=<VectorMap>(cmap);
       
   127     }
       
   128 
       
   129 
       
   130     /// \brief Template assign operator.
       
   131     ///
       
   132     /// The given parameter should be conform to the ReadMap
       
   133     /// concecpt and could be indiced by the current item set of
       
   134     /// the NodeMap. In this case the value for each item
       
   135     /// is assigned by the value of the given ReadMap. 
       
   136     template <typename CMap>
       
   137     VectorMap& operator=(const CMap& cmap) {
       
   138       checkConcept<concept::ReadMap<Key, _Value>, CMap>();
       
   139       const typename Parent::Notifier* notifier = Parent::getNotifier();
       
   140       Item it;
       
   141       for (notifier->first(it); it != INVALID; notifier->next(it)) {
       
   142         set(it, cmap[it]);
       
   143       }
       
   144       return *this;
       
   145     }
       
   146     
   119   public:
   147   public:
   120 
   148 
   121     /// \brief The subcript operator.
   149     /// \brief The subcript operator.
   122     ///
   150     ///
   123     /// The subscript operator. The map can be subscripted by the
   151     /// The subscript operator. The map can be subscripted by the