title: structured bindings: when something looks like a reference and behaves similarly to a reference, but it's not a reference
body: <p>Yesterday I've seen <a href="https://stackoverflow.com/questions/44671697/what-are-the-types-of-identifiers-introduced-by-structured-bindings-in-c17/44672220#44672220">an interesting question</a> here on SO about structured binding.<br>
  We can sum up it as it follows. Consider the example code below:</p>
  
  <pre><code>#include &lt;tuple&gt;
  #include &lt;type_traits&gt;
  
  int main() {
      auto tup = std::make_tuple(1, 2);
      auto &amp; [ a, b ] = tup;
      // the following line won't compile for a isn't a reference
      // static_assert(std::is_reference_v&lt;decltype(a)&gt;);
  }
  </code></pre>
  
  <p>In this case <code>decltype(a)</code> is <code>int</code> (probably) because of <a href="http://eel.is/c++draft/dcl.type.simple#4.1" rel="noreferrer">this bullet</a> (working draft):</p>
  
  <blockquote>
    <p>if <code>e</code> is an unparenthesized id-expression naming a structured binding [...], <code>decltype(e)</code> is the referenced type as given in the specification of the structured binding declaration</p>
  </blockquote>
  
  <p><a href="https://wandbox.org/permlink/BKLeZRzPubEsPC5l" rel="noreferrer">Here</a> is a snippet on wandbox provided by @Curious in the comments for those that are interested. It shows that actually <code>a</code> isn't a reference, nothing more.<br>
  So far so good for the original question, OP asked why it was <code>int</code> instead of <code>int &amp;</code> and <em>the standard says that</em> looked like an acceptable answer.</p>
  
  <p>Anyway, I'd like to know why the committee decided so. At the end of the day, <code>a</code> refers to an element in the tuple and I can modify that element through <code>a</code>. In other terms, the declaration of <code>a</code> looks like the one of a reference, it behaves similarly to a reference but it's not a reference.  </p>
  
  <p>I can live with this, but I'd like to know what are the reasons behind that. Why <code>decltype(a)</code> cannot be simply <code>int &amp;</code>? Is there a meaningful reason that a profane can understand?</p>