title: Strong exception guarantee VS basic exception guarantee
body: <p>By Abrahams we have 3 types of exception : </p>
  
  <ol>
  <li>Nothrow </li>
  <li>Basic exception guarantee</li>
  <li>Strong exception guarantee</li>
  </ol>
  
  <p>Basic means (<strong>please correct me if I'm wrong</strong>) that Invariants are preserved e.g that the invariants of the component are preserved, and no resources are leaked , where Strong that the operation has either completed successfully or thrown an exception, leaving the program state exactly as it was before the operation started . </p>
  
  <ol>
  <li><p>What does it mean that Invariants are preserved ? that if I have a valid value in one of my variables then it wouldn't (take for example a pointer) hold a <code>NULL</code> ? </p></li>
  <li><p>Referring to Strong exception guarantee , does it mean that all my variables would store the exact same values before the exception was thrown  ? </p></li>
  </ol>
  
  <p>for example : </p>
  
  <pre><code>int main()
  
  {
      int j = 1;
      int *p = &amp;j;
  
      // do some stuff
      j = 2;
      throw 1;
  
  }
  </code></pre>
  
  <p>Then after I throw , <code>j</code> would hold the value <code>2</code> or <code>1</code> ? </p>
  
  <p>Regards</p>