title: C++11 empty flag classes
body: <p>In some of the <code>unique_lock</code> <a href="http://en.cppreference.com/w/cpp/thread/unique_lock/unique_lock">constructors</a> in C++11 one can pass some <a href="http://en.cppreference.com/w/cpp/thread/lock_tag_t">classes</a> like a flag, i.e.</p>
  
  <pre><code>auto lock = std::unique_lock&lt;std::mutex&gt; lock(m, std::defer_lock);
  </code></pre>
  
  <p>where <code>std::defer_lock</code> is defined as</p>
  
  <pre><code>struct defer_lock {}
  </code></pre>
  
  <p>Why is it done this way, and not with an enum?</p>
  
  <p>I tried to apply this to a small code sample, but I couldn't get it compiling:</p>
  
  <pre><code>class A {};
  void foo(A a) {}
  
  int main() {
    foo(A); // error: 'A' does not refer to a value
  }
  </code></pre>
  
  <p>When I put the parentheses like <code>foo(A());</code> it works, but I don't see the difference to the STL. Why does this behave differently there?</p>