What is the difference between std::shared_ptr and std::experimental::atomic_shared_ptr?
<p>I read the <a href="https://www.justsoftwaresolutions.co.uk/threading/why-do-we-need-atomic_shared_ptr.html" rel="noreferrer">following</a> article by <em>Antony Williams</em> and as I understood in addition to the atomic shared count in <code>std::shared_ptr</code> in <code>std::experimental::atomic_shared_ptr</code> the actual pointer to the shared object is also atomic?</p>

<p>But when I read about reference counted version of <code>lock_free_stack</code> described in Antony's book about <a href="https://rads.stackoverflow.com/amzn/click/com/1933988770" rel="noreferrer" rel="nofollow noreferrer">C++ Concurrency</a> it seems for me that the same aplies also for <code>std::shared_ptr</code>, because functions like <code>std::atomic_load</code>, <code>std::atomic_compare_exchnage_weak</code> are applied to the instances of <code>std::shared_ptr</code>.</p>

<pre><code>template &lt;class T&gt;
class lock_free_stack
{
public:
  void push(const T&amp; data)
  {
    const std::shared_ptr&lt;node&gt; new_node = std::make_shared&lt;node&gt;(data);
    new_node-&gt;next = std::atomic_load(&amp;head_);
    while (!std::atomic_compare_exchange_weak(&amp;head_, &amp;new_node-&gt;next, new_node));
  }

  std::shared_ptr&lt;T&gt; pop()
  {
    std::shared_ptr&lt;node&gt; old_head = std::atomic_load(&amp;head_);
    while(old_head &amp;&amp;
          !std::atomic_compare_exchange_weak(&amp;head_, &amp;old_head, old_head-&gt;next));
    return old_head ? old_head-&gt;data : std::shared_ptr&lt;T&gt;();
  }

private:
  struct node
  {
    std::shared_ptr&lt;T&gt; data;
    std::shared_ptr&lt;node&gt; next;

    node(const T&amp; data_) : data(std::make_shared&lt;T&gt;(data_)) {}
  };

private:
  std::shared_ptr&lt;node&gt; head_;
};
</code></pre>

<p>What is the exact difference between this two types of smart pointers, and if pointer in <code>std::shared_ptr</code> instance is not atomic, why it is possible the above lock free stack implementation?</p>