In book "C++ Concurrency in Action: Practical Multithreading" by Anthony Williams I found this code example
template<typename T> class threadsafe_stack { private: std::stack<T> data; mutable std::mutex m; public: threadsafe_stack(){} threadsafe_stack (const threadsafe_stack& other) { std::lock_guard<<std::mutex> lock(other.m); ... rest of the code. (in my version of the book this is listing 3.5)
Why I have direct access to other object private data (mutex m in this case)? Maybe I missed something or maybe this is a typo (I have Russian version of the book and there is no errata)
Thanks in advance.
Dmitry.
privatemembers from other instances within the same class.operator=, etc etc).