Fix problem with temporal iterator parameters (#325)
authorBalazs Dezso <deba@google.com>
Tue, 14 Apr 2015 16:36:45 +0200
changeset 113393d455c647be
parent 1132 0998f70d0b2d
child 1136 20f95cd51aba
Fix problem with temporal iterator parameters (#325)
lemon/bits/stl_iterators.h
     1.1 --- a/lemon/bits/stl_iterators.h	Tue Apr 14 16:14:32 2015 +0200
     1.2 +++ b/lemon/bits/stl_iterators.h	Tue Apr 14 16:36:45 2015 +0200
     1.3 @@ -55,12 +55,13 @@
     1.4    /// \c P is the type of the parameter of the constructor of \c LIT.
     1.5    template<class LIT, class P>
     1.6    class LemonRangeWrapper1 {
     1.7 -    const P &_p;
     1.8      typedef LemonItWrapper<LIT> It;
     1.9 +    It _begin;
    1.10 +    
    1.11    public:
    1.12 -    LemonRangeWrapper1(const P &p) : _p(p) {}
    1.13 +    LemonRangeWrapper1(const P &p) : _begin(LIT(p)) {}
    1.14      It begin() const {
    1.15 -      return It(LIT(_p));
    1.16 +      return _begin;
    1.17      }
    1.18      It end() const {
    1.19        return It(lemon::INVALID);
    1.20 @@ -80,13 +81,12 @@
    1.21    /// of the constructor of \c LIT.
    1.22    template<class LIT, class P1, class P2>
    1.23    class LemonRangeWrapper2 {
    1.24 -    const P1 &_p1;
    1.25 -    const P2 &_p2;
    1.26 -    typedef LemonItWrapper<LIT> It;
    1.27 -  public:
    1.28 -    LemonRangeWrapper2(const P1 &p1, const P2 &p2) : _p1(p1), _p2(p2) {}
    1.29 +    typedef LemonItWrapper<LIT> It; 
    1.30 +    It _begin;
    1.31 + public:
    1.32 +    LemonRangeWrapper2(const P1 &p1, const P2 &p2) : _begin(LIT(p1, p2)) {}
    1.33      It begin() const {
    1.34 -      return It(LIT(_p1, _p2));
    1.35 +      return _begin;
    1.36      }
    1.37      It end() const {
    1.38        return It(lemon::INVALID);