I would use
~node() noexcept {
while (next) {
nextstd::shared_ptr<node> =t;
std::shared_ptr<node>swap(t,next)->next;>next);
next = t;
}
}
The idea is to erase the list tail in a node destructor by holding the pointer to the next node in temporary, then removing the pointer from the current node (by assigning to it next->next), and finally destroying temporary and so on.