In the previous post about lazy initialisation, we showed examples and differences between using raw pointers, unique_ptr
and std::optional
to store the object and create it later. However, we implemented the samples from the perspective of single-threaded scenarios.
In this post, we’ll try to fill the gap and show you how to make your lazy objects available in a multithreading environment.
Read more...