COIN-OR::LEMON - Graph Library

Changeset 1130:0759d974de81 in lemon-main for lemon/maps.h


Ignore:
Timestamp:
01/05/14 22:24:56 (10 years ago)
Author:
Gabor Gevay <ggab90@…>
Branch:
default
Phase:
public
Message:

STL style iterators (#325)

For

  • graph types,
  • graph adaptors,
  • paths,
  • iterable maps,
  • LP rows/cols and
  • active nodes is BellmanFord?
File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/maps.h

    r1092 r1130  
    2626
    2727#include <lemon/core.h>
     28#include <lemon/bits/stl_iterators.h>
    2829
    2930///\file
     
    25822583    };
    25832584
     2585    /// \brief STL style iterator for the keys mapped to \c true.
     2586    ///
     2587    /// This is an STL style wrapper for \ref TrueIt.
     2588    /// It can be used in range-based for loops, STL algorithms, etc.
     2589    LemonRangeWrapper1<TrueIt, IterableBoolMap>
     2590    trueKeys() {
     2591      return LemonRangeWrapper1<TrueIt, IterableBoolMap>(*this);
     2592    }
     2593
     2594
    25842595    /// \brief Iterator for the keys mapped to \c false.
    25852596    ///
     
    26202631      const IterableBoolMap* _map;
    26212632    };
     2633
     2634    /// \brief STL style iterator for the keys mapped to \c false.
     2635    ///
     2636    /// This is an STL style wrapper for \ref FalseIt.
     2637    /// It can be used in range-based for loops, STL algorithms, etc.
     2638    LemonRangeWrapper1<FalseIt, IterableBoolMap>
     2639    falseKeys() {
     2640      return LemonRangeWrapper1<FalseIt, IterableBoolMap>(*this);
     2641    }
     2642
    26222643
    26232644    /// \brief Iterator for the keys mapped to a given value.
     
    26642685      const IterableBoolMap* _map;
    26652686    };
     2687
     2688    /// \brief STL style iterator for the keys mapped to a given value.
     2689    ///
     2690    /// This is an STL style wrapper for \ref ItemIt.
     2691    /// It can be used in range-based for loops, STL algorithms, etc.
     2692    LemonRangeWrapper2<ItemIt, IterableBoolMap, bool>
     2693    items(bool value) {
     2694      return LemonRangeWrapper2<ItemIt, IterableBoolMap, bool>(*this, value);
     2695    }
    26662696
    26672697  protected:
     
    30063036    };
    30073037
     3038    /// \brief STL style iterator for the keys with the same value.
     3039    ///
     3040    /// This is an STL style wrapper for \ref ItemIt.
     3041    /// It can be used in range-based for loops, STL algorithms, etc.
     3042    LemonRangeWrapper2<ItemIt, IterableIntMap, int>
     3043    items(int value) {
     3044      return LemonRangeWrapper2<ItemIt, IterableIntMap, int>(*this, value);
     3045    }
     3046
     3047
    30083048  protected:
    30093049
     
    32493289    };
    32503290
     3291    /// \brief STL style iterator for the keys with the same value.
     3292    ///
     3293    /// This is an STL style wrapper for \ref ItemIt.
     3294    /// It can be used in range-based for loops, STL algorithms, etc.
     3295    LemonRangeWrapper2<ItemIt, IterableValueMap, V>
     3296    items(const V& value) {
     3297      return LemonRangeWrapper2<ItemIt, IterableValueMap, V>(*this, value);
     3298    }
     3299
     3300
    32513301  protected:
    32523302
Note: See TracChangeset for help on using the changeset viewer.