The error message indicates that head_ is a pointer to Node, and the compiler is expecting it to be an object with a member function called compare_exchange_weak. To access compare_exchange_weak, you need to use the arrow operator (->) instead of the dot operator (.) to access the member of the pointed-to object.
In this case, change head_.compare_exchange_weak(old_head, new_head, std::memory_order_acquire) to head_->compare_exchange_weak(old_head, new_head, std::memory_order_acquire).




