title: Why is it illegal/immoral to reseat a reference?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/728233/why-are-references-not-reseatable-in-c">Why are references not reseatable in C++</a>  </p>
  </blockquote>
  
  <p>I am trying to more or less swap two reference variables (as practice, I could have swapped the actual variables). I tried doing this by making a temporary variable and making one of the references equal the other, but this got shot down by the compiler. Here is an example:</p>
  
  <pre><code>void Foo()
  {
     //code
     int&amp; ref1 = a;
     int&amp; ref2 = b;
     int temp;
  
     temp = ref1;
     ref1 = ref2;
     ref2 = temp;
  
     //or, better yet
     std::swap(ref1, ref2);
  }
  </code></pre>
  
  <p>I got an error, and looked on the faq lite. It details that they cannot be reseated, but does not explain why. Why?</p>
  
  <p><a href="https://isocpp.org/wiki/faq/references#reseating-refs" rel="nofollow noreferrer">Here</a> is a link to the Faq Lite for reference (&lt;---, get it?).</p>