title: What are good use-cases for tuples in C++11?
body: <p>What are good use-cases for using tuples in C++11?  For example, I have a function that defines a local struct as follows:</p>
  
  <pre><code>template&lt;typename T, typename CmpF, typename LessF&gt;
  void mwquicksort(T *pT, int nitem, const int M, CmpF cmp, LessF less)
  {
    struct SI
    {
      int l, r, w;
      SI() {}
      SI(int _l, int _r, int _w) : l(_l), r(_r), w(_w) {}
    } stack[40];
  
    // etc
  </code></pre>
  
  <p>I was considering to replace the <code>SI</code> struct with an <code>std::tuple&lt;int,int,int&gt;</code>, which is a far shorter declaration with convenient constructors and operators already predefined, but with the following disadvantages:</p>
  
  <ul>
  <li>Tuple elements are hidden in obscure, implementation-defined structs.  Even though Visual studio interprets and shows their contents nicely, I still can't put conditional breakpoints that depend on value of tuple elements.</li>
  <li>Accessing individual tuple fields (<code>get&lt;0&gt;(some_tuple)</code>) is far more verbose than accessing struct elements (<code>s.l</code>).</li>
  <li>Accessing fields by name is far more informative (and shorter!) than by numeric index.</li>
  </ul>
  
  <p>The last two points are somewhat addressed by the <code>tie</code> function.  Given these disadvantages, what would be a good use-case for tuples?</p>
  
  <p><strong>UPDATE</strong> Turns out that VS2010 SP1 debugger cannot show the contents of the following array <code>std::tuple&lt;int, int, int&gt; stack[40]</code>, but it works fine when it's coded with a struct. So the decision is basically a no-brainer: if you'll ever have to inspect its values, use a struct [esp. important with debuggers like GDB].</p>