lemon/maps.h
changeset 1130 0759d974de81
parent 1092 dceba191c00d
child 1210 da87dbdf3daf
     1.1 --- a/lemon/maps.h	Thu Apr 02 22:34:03 2015 +0200
     1.2 +++ b/lemon/maps.h	Sun Jan 05 22:24:56 2014 +0100
     1.3 @@ -25,6 +25,7 @@
     1.4  #include <map>
     1.5  
     1.6  #include <lemon/core.h>
     1.7 +#include <lemon/bits/stl_iterators.h>
     1.8  
     1.9  ///\file
    1.10  ///\ingroup maps
    1.11 @@ -2581,6 +2582,16 @@
    1.12        const IterableBoolMap* _map;
    1.13      };
    1.14  
    1.15 +    /// \brief STL style iterator for the keys mapped to \c true.
    1.16 +    ///
    1.17 +    /// This is an STL style wrapper for \ref TrueIt.
    1.18 +    /// It can be used in range-based for loops, STL algorithms, etc.
    1.19 +    LemonRangeWrapper1<TrueIt, IterableBoolMap>
    1.20 +    trueKeys() {
    1.21 +      return LemonRangeWrapper1<TrueIt, IterableBoolMap>(*this);
    1.22 +    }
    1.23 +
    1.24 +
    1.25      /// \brief Iterator for the keys mapped to \c false.
    1.26      ///
    1.27      /// Iterator for the keys mapped to \c false. It works
    1.28 @@ -2620,6 +2631,16 @@
    1.29        const IterableBoolMap* _map;
    1.30      };
    1.31  
    1.32 +    /// \brief STL style iterator for the keys mapped to \c false.
    1.33 +    ///
    1.34 +    /// This is an STL style wrapper for \ref FalseIt.
    1.35 +    /// It can be used in range-based for loops, STL algorithms, etc.
    1.36 +    LemonRangeWrapper1<FalseIt, IterableBoolMap>
    1.37 +    falseKeys() {
    1.38 +      return LemonRangeWrapper1<FalseIt, IterableBoolMap>(*this);
    1.39 +    }
    1.40 +
    1.41 +
    1.42      /// \brief Iterator for the keys mapped to a given value.
    1.43      ///
    1.44      /// Iterator for the keys mapped to a given value. It works
    1.45 @@ -2664,6 +2685,15 @@
    1.46        const IterableBoolMap* _map;
    1.47      };
    1.48  
    1.49 +    /// \brief STL style iterator for the keys mapped to a given value.
    1.50 +    ///
    1.51 +    /// This is an STL style wrapper for \ref ItemIt.
    1.52 +    /// It can be used in range-based for loops, STL algorithms, etc.
    1.53 +    LemonRangeWrapper2<ItemIt, IterableBoolMap, bool>
    1.54 +    items(bool value) {
    1.55 +      return LemonRangeWrapper2<ItemIt, IterableBoolMap, bool>(*this, value);
    1.56 +    }
    1.57 +
    1.58    protected:
    1.59  
    1.60      virtual void add(const Key& key) {
    1.61 @@ -3005,6 +3035,16 @@
    1.62        const IterableIntMap* _map;
    1.63      };
    1.64  
    1.65 +    /// \brief STL style iterator for the keys with the same value.
    1.66 +    ///
    1.67 +    /// This is an STL style wrapper for \ref ItemIt.
    1.68 +    /// It can be used in range-based for loops, STL algorithms, etc.
    1.69 +    LemonRangeWrapper2<ItemIt, IterableIntMap, int>
    1.70 +    items(int value) {
    1.71 +      return LemonRangeWrapper2<ItemIt, IterableIntMap, int>(*this, value);
    1.72 +    }
    1.73 +
    1.74 +
    1.75    protected:
    1.76  
    1.77      virtual void erase(const Key& key) {
    1.78 @@ -3248,6 +3288,16 @@
    1.79        const IterableValueMap* _map;
    1.80      };
    1.81  
    1.82 +    /// \brief STL style iterator for the keys with the same value.
    1.83 +    ///
    1.84 +    /// This is an STL style wrapper for \ref ItemIt.
    1.85 +    /// It can be used in range-based for loops, STL algorithms, etc.
    1.86 +    LemonRangeWrapper2<ItemIt, IterableValueMap, V>
    1.87 +    items(const V& value) {
    1.88 +      return LemonRangeWrapper2<ItemIt, IterableValueMap, V>(*this, value);
    1.89 +    }
    1.90 +
    1.91 +
    1.92    protected:
    1.93  
    1.94      virtual void add(const Key& key) {