title: Any disadvantages for std::atomic_flag not providing load or store operations? (Spin-lock example)
body: <p>Comparing a <a href="https://en.cppreference.com/w/cpp/atomic/atomic_flag" rel="nofollow noreferrer"><code>std::atomic_flag</code></a> to an <code>std::atomic_bool</code> (aka <a href="https://en.cppreference.com/w/cpp/atomic/atomic" rel="nofollow noreferrer"><code>std::atomic&lt;bool&gt;</code></a>), it seems to me that a <code>std::atomic_flag</code> just has a simpler interface. It provides only testing+setting and clearing the flag while an <code>std::atomic_bool</code> also provides overloads to several operators.</p>
  
  <p>One question of mine is about terminology: What is meant by "load or store operations"? Does it mean that it is not possible to arbitrarily read and modify a <code>std::atomic_flag</code>'s value? </p>
  
  <p>Furthermore, I am wondering, could a <code>std::atomic_bool</code> be faster when being used for a spin-lock? It seems to me that an <code>std::atomic_flag</code> always must read AND write during a spin-lock:</p>
  
  <pre><code>while (my_atomic_flag.test_and_set()); // spin-lock
  </code></pre>
  
  <p>while an <code>std::atomic_bool</code> would only have to perform a read operation (assuming that the atomic bool is implemented lock-free):</p>
  
  <pre><code>while (my_atomic_bool); // spin-lock
  </code></pre>
  
  <p>Is an <code>std::atomic_flag</code> strictly more efficient than an <code>std::atomic_bool</code> or could it also be the other way round? What should be used for a spin-lock?</p>