title: Why put std::lock before std::lock_guard
body: <p>Moving forward with <a href="http://www.bogotobogo.com/cplusplus/files/CplusplusConcurrencyInAction_PracticalMultithreading.pdf" rel="noreferrer">Concurrency In Action</a> I have reached the following example.<br>
  Tha author states that if we everytime lock 2 <a href="http://en.cppreference.com/w/cpp/thread/mutex" rel="noreferrer">mutexes</a> in the same order, then we are guaranteed to avoid <a href="https://en.wikipedia.org/wiki/Deadlock" rel="noreferrer">deadlocks</a>.<br>
   Consider this example from the book:</p>
  
  <pre><code>class X
  {
      private:
      some_big_object some_detail;
      std::mutex m;
  public:
      X(some_big_object const&amp; sd):some_detail(sd){}
      friend void swap(X&amp; lhs, X&amp; rhs)
      {
         if(&amp;lhs==&amp;rhs){return;}
         std::lock(lhs.m,rhs.m);
         std::lock_guard&lt;std::mutex&gt; lock_a(lhs.m,std::adopt_lock);
         std::lock_guard&lt;std::mutex&gt; lock_b(rhs.m,std::adopt_lock);
         swap(lhs.some_detail,rhs.some_detail);
      }
  };
  </code></pre>
  
  <ol>
  <li>Why do we apply the <a href="http://en.cppreference.com/w/cpp/thread/lock" rel="noreferrer"><code>std::lock</code></a> and then apply 2 <a href="http://en.cppreference.com/w/cpp/thread/lock_guard" rel="noreferrer"><code>std::lock_guards</code></a> with <a href="http://en.cppreference.com/w/cpp/thread/lock_tag_t" rel="noreferrer"><code>std::adopt_lock</code></a> instead of just applying 2 <code>std::lock_guards</code> one after another??     </li>
  <li>Why cant we just put this 2 <a href="http://en.cppreference.com/w/cpp/thread/mutex" rel="noreferrer"><code>std::mutex</code></a>es in the <a href="http://en.cppreference.com/w/cpp/thread/scoped_lock" rel="noreferrer"><code>std::scoped_lock</code></a>?? </li>
  </ol>