In this final chapter of the miniseries, we consider the effects of thread safety on copy-on-write strings. Is lazy copy really an optimization? The answer may surprise you.
Why is Optimized::String (from Item 15) not thread-safe? Give examples.
Demonstrate how to make Optimized::String thread-safe:
assuming there are atomic operations to get, set, and compare integer values; and