lemon/bits/array_map.h
changeset 2031 080d51024ac5
parent 1999 2ff283124dfc
child 2046 66d160810c0a
     1.1 --- a/lemon/bits/array_map.h	Mon Apr 03 09:24:38 2006 +0000
     1.2 +++ b/lemon/bits/array_map.h	Mon Apr 03 09:45:23 2006 +0000
     1.3 @@ -23,6 +23,8 @@
     1.4  
     1.5  #include <lemon/bits/traits.h>
     1.6  #include <lemon/bits/alteration_notifier.h>
     1.7 +#include <lemon/concept_check.h>
     1.8 +#include <lemon/concept/maps.h>
     1.9  
    1.10  /// \ingroup graphbits
    1.11  /// \file
    1.12 @@ -119,6 +121,35 @@
    1.13        }
    1.14      }
    1.15  
    1.16 +    /// \brief Assign operator.
    1.17 +    ///
    1.18 +    /// This operator assigns for each item in the map the
    1.19 +    /// value mapped to the same item in the copied map.  
    1.20 +    /// The parameter map should be indiced with the same
    1.21 +    /// itemset because this assign operator does not change
    1.22 +    /// the container of the map. 
    1.23 +    ArrayMap& operator=(const ArrayMap& cmap) {
    1.24 +      return operator=<ArrayMap>(cmap);
    1.25 +    }
    1.26 +
    1.27 +
    1.28 +    /// \brief Template assign operator.
    1.29 +    ///
    1.30 +    /// The given parameter should be conform to the ReadMap
    1.31 +    /// concecpt and could be indiced by the current item set of
    1.32 +    /// the NodeMap. In this case the value for each item
    1.33 +    /// is assigned by the value of the given ReadMap. 
    1.34 +    template <typename CMap>
    1.35 +    ArrayMap& operator=(const CMap& cmap) {
    1.36 +      checkConcept<concept::ReadMap<Key, _Value>, CMap>();
    1.37 +      const typename Parent::Notifier* notifier = Parent::getNotifier();
    1.38 +      Item it;
    1.39 +      for (notifier->first(it); it != INVALID; notifier->next(it)) {
    1.40 +        set(it, cmap[it]);
    1.41 +      }
    1.42 +      return *this;
    1.43 +    }
    1.44 +
    1.45      /// \brief The destructor of the map.
    1.46      ///     
    1.47      /// The destructor of the map.
    1.48 @@ -129,10 +160,6 @@
    1.49        }
    1.50      }
    1.51  		
    1.52 -  private:
    1.53 -
    1.54 -    ArrayMap& operator=(const ArrayMap&);
    1.55 -
    1.56    protected:
    1.57  
    1.58      using Parent::attach;