title: What type should I use for a range (of array indices)?
body: <p>I need to write some functions returning ranges within an array (you may, if you like, assume they're specified as starting position and length). I can't return a tuple, so I need to return some other type (and maybe it's a good idea anyway). Now, I'd like to return something that's both (somewhat) standard and does not incur a performance penalty due to vtables, convoluted ctors etc.</p>
  
  <p>The options that come to mind are:</p>
  
  <ol>
  <li><code>std::pair&lt;unsigned&gt;</code> (or <code>std::pair&lt;size_t&gt;</code>).</li>
  <li>a struct wrapping two <code>unsigned</code>s (or <code>size_t</code>'s).</li>
  <li>Rolling my own Range class, sugar-coating it with utility methods.</li>
  </ol>
  
  <p>I tried looking for a proper Range class, but couldn't find one. It's kind of strange that nothing in the standard library/STL uses a class for ranges.</p>
  
  <p>Are there better alternatives? And if there aren't, which of the above would you recommend?</p>