• Mark OLESEN's avatar
    ENH: simplify and extend labelRange · 5d541def
    Mark OLESEN authored
    - add increment/decrement, repositioning. Simplify const_iterator.
    
    - this makes is much easier to use labelRange for constructing ranges of
      sub-lists. For symmetry with setSize() it has a setStart() instead of
      simply assigning to start() directly. This would also provide the
      future possibility to imbue the labelRange with a particular policy
      (eg, no negative starts, max size etc) and ensure that they are
      enforced.
    
      A simple use case:
    
        // initialize each to zero...
        List<labelRange> subListRanges = ...;
    
        // scan and categorize
        if (condition)
           subListRanges[categoryI]++;  // increment size for that category
    
        // finally, set the starting points
        start = 0;
        for (labelRange& range : subListRanges)
        {
            range.setStart(start);
            start += range.size();
        }
    5d541def