lemon/bits/stl_iterators.h
changeset 1210 da87dbdf3daf
parent 1130 0759d974de81
equal deleted inserted replaced
0:01cb0eecefbf 1:c503b2466867
    53   ///
    53   ///
    54   /// \c LIT is the Lemon iterator that will be wrapped
    54   /// \c LIT is the Lemon iterator that will be wrapped
    55   /// \c P is the type of the parameter of the constructor of \c LIT.
    55   /// \c P is the type of the parameter of the constructor of \c LIT.
    56   template<class LIT, class P>
    56   template<class LIT, class P>
    57   class LemonRangeWrapper1 {
    57   class LemonRangeWrapper1 {
    58     const P &_p;
       
    59     typedef LemonItWrapper<LIT> It;
    58     typedef LemonItWrapper<LIT> It;
       
    59     It _begin;
       
    60     
    60   public:
    61   public:
    61     LemonRangeWrapper1(const P &p) : _p(p) {}
    62     LemonRangeWrapper1(const P &p) : _begin(LIT(p)) {}
    62     It begin() const {
    63     It begin() const {
    63       return It(LIT(_p));
    64       return _begin;
    64     }
    65     }
    65     It end() const {
    66     It end() const {
    66       return It(lemon::INVALID);
    67       return It(lemon::INVALID);
    67     }
    68     }
    68   };
    69   };
    78   /// \c LIT is the Lemon iterator that will be wrapped
    79   /// \c LIT is the Lemon iterator that will be wrapped
    79   /// \c P1 and \c P2 are the types of the parameters
    80   /// \c P1 and \c P2 are the types of the parameters
    80   /// of the constructor of \c LIT.
    81   /// of the constructor of \c LIT.
    81   template<class LIT, class P1, class P2>
    82   template<class LIT, class P1, class P2>
    82   class LemonRangeWrapper2 {
    83   class LemonRangeWrapper2 {
    83     const P1 &_p1;
    84     typedef LemonItWrapper<LIT> It; 
    84     const P2 &_p2;
    85     It _begin;
    85     typedef LemonItWrapper<LIT> It;
    86  public:
    86   public:
    87     LemonRangeWrapper2(const P1 &p1, const P2 &p2) : _begin(LIT(p1, p2)) {}
    87     LemonRangeWrapper2(const P1 &p1, const P2 &p2) : _p1(p1), _p2(p2) {}
       
    88     It begin() const {
    88     It begin() const {
    89       return It(LIT(_p1, _p2));
    89       return _begin;
    90     }
    90     }
    91     It end() const {
    91     It end() const {
    92       return It(lemon::INVALID);
    92       return It(lemon::INVALID);
    93     }
    93     }
    94   };
    94   };