Skip to content
  • Mark OLESEN's avatar
    ENH: improvements to labelRange const_iterator · 83669e28
    Mark OLESEN authored
    - inherit from std::iterator to obtain the full STL typedefs, meaning
      that std::distance works and the following is now possible:
    
          labelRange range(100, 1500);
          scalarList list(range.begin(), range.end());
    
      --
      Note that this does not work (mismatched data-types):
    
          scalarList list = identity(12345);
    
      But this does, since the *iter promotes label to scalar:
    
          labelList ident = identity(12345);
          scalarList list(ident.begin(), ident.end());
    
      It is however more than slightly wasteful to create a labelList
      just for initializing a scalarList. An alternative could be a
      a labelRange for the same purpose.
    
          labelRange ident = labelRange::identity(12345);
          scalarList list(ident.begin(), ident.end());
    
      Or this
          scalarList list
          (
              labelRange::null.begin(),
              labelRange::identity(12345).end()
          );
    83669e28