```
// Example program
#include <iostream>
#include <string>
#include <memory>
#include <atomic>

struct Smth {};

struct B { //Used in thread 2
    B(std::shared_ptr<Smth>* smth) : smth_(smth) {};
    ~B();
    void DoSomething() {
        std::shared_ptr<Smth> newSmth = std::make_shared<Smth>();
        smth_->swap(newSmth);
    }
    std::shared_ptr<Smth>* smth_;
};

struct A { //Used in thread 1&3
  A() : smth_(std::make_shared<Smth>()), b_(&smth_) {};
  ~A();
  std::shared_ptr<Smth> smth_;
  B b_;
};

```

So is it good practice to pass pointer to shared\_ptr so that i can swap the contents of shared\_ptr in the separate thread?
The second question is should I use the std::atomic\_store to replace the shared\_ptr::swap, if so how should i do that?