title: std::mutex vs std::recursive_mutex as class member
body: <p>I have seen some people hate on <code>recursive_mutex</code>:</p>
  
  <p><a href="http://www.zaval.org/resources/library/butenhof1.html" rel="noreferrer">http://www.zaval.org/resources/library/butenhof1.html</a></p>
  
  <p>But when thinking about how to implement a class that is thread safe (mutex protected), it seems to me excruciatingly hard to prove that every method that should be mutex protected is mutex protected and that mutex is locked at most once. </p>
  
  <p>So for object oriented design, should <code>std::recursive_mutex</code> be default and <code>std::mutex</code> considered as an performance optimization in general case unless it is used only in one place (to protect only one resource)?</p>
  
  <p>To make things clear, I'm talking about one private nonstatic mutex. So each class instance has only one mutex.</p>
  
  <p>At the beginning of each public method:</p>
  
  <pre><code>{
      std::scoped_lock&lt;std::recursive_mutex&gt; sl;
  </code></pre>