boost-smart-ptr

Code reading: where can I read great, modern, and well-documented C++ code?

Reading code is one of the best ways to learn new idioms, tricks, and techniques. Sadly it's very common to find badly written C++ code. Some use C++ as if it was C, others as if it was Java, some just shoot in their feet. I believe gtkmm is a good example of C++ design, but a binding could not be the best code to read (you need to kn...

using smart pointers with "this"

I'm learning the use of boost smart pointers but I'm a bit confused about a few situations. Let's say I'm implementing a state machine where each state is implemented by a single update method. Each state could return itself or create a new state object: struct state { virtual state* update() = 0; // The point: I want to return a ...

Reading a boost shared_ptr atomically

Hi, I have 2 threads that access this one object. Thread A: updates a boost hared_ptr member Thread B: reads that boost shared_ptr member Since a shared_ptr isn't an integer/real pointer type, it cannot be read atomically by Thread B. I want to avoid locks. How can I guarentee that Thread B gets a valid shared_ptr? Thanks! ...