title: Copy Class with std::mutex
body: <p>I have a class with a std::mutex as a member. I am trying to create an array of such class</p>
  
  <pre><code>class C
  {
   int x;
   std::mutex m;
  };
  
  int main()
  {
    C c[10];
    //later trying to create a temp C
    C temp = c[0];
  }
  </code></pre>
  
  <p>Clearly the above is not possible as mutex object is not copyable. The way to solve it is through a copy constructor.</p>
  
  <p>However, I am having problem in creating a copy constructor. I have tried</p>
  
  <pre><code>C (const C &amp;c)
  {
     x = c.x;
  
     //1. m
     //2. m()
     //3. m = c.m
  }
  </code></pre>
  
  <p>I am not sure what is the right syntax out of the 3 choices. Please help.</p>