Changeset 17:1b2e312c7b52 in rrlib_uri


Ignore:
Timestamp:
10.02.2021 21:23:51 (3 months ago)
Author:
Max Reichardt <max.reichardt@…>
Branch:
17.03
Phase:
public
Message:

Makes path iterator copy constructible (erroneously wasn't)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tPath.h

    r13 r17  
    305305 
    306306    tConstIterator(const tPath& path, size_t element_index) : 
    307       path(path), 
     307      path(&path), 
    308308      element_index(element_index), 
    309309      element() 
     
    314314    friend bool operator==(const tConstIterator& lhs, const tConstIterator& rhs) 
    315315    { 
    316       return (&lhs.path == &rhs.path) && lhs.element_index == rhs.element_index; 
     316      return (*lhs.path == *rhs.path) && lhs.element_index == rhs.element_index; 
    317317    } 
    318318    friend bool operator!=(const tConstIterator& lhs, const tConstIterator& rhs) 
     
    350350    friend tConstIterator operator+(const tConstIterator& lhs, size_t rhs) 
    351351    { 
    352       return tConstIterator(lhs.path, lhs.element_index + rhs); 
     352      return tConstIterator(*lhs.path, lhs.element_index + rhs); 
    353353    } 
    354354    friend tConstIterator operator-(const tConstIterator& lhs, size_t rhs) 
    355355    { 
    356       return tConstIterator(lhs.path, lhs.element_index - rhs); 
     356      return tConstIterator(*lhs.path, lhs.element_index - rhs); 
    357357    } 
    358358 
    359359  private: 
    360360 
    361     const tPath& path; 
     361    const tPath* path; 
    362362    size_t element_index; 
    363363    tElement element; 
     
    365365    void UpdateElement() 
    366366    { 
    367       element = element_index >= path.element_count ? tStringRange() : path[element_index]; 
     367      element = element_index >= path->element_count ? tStringRange() : (*path)[element_index]; 
    368368    } 
    369369  }; 
Note: See TracChangeset for help on using the changeset viewer.