I read through the accelerated DateTime library here , which contains many examples like this one:
time_zone_ptr zone(new posix_time_zone("MST-07"));
I was curious why using the keyword 'new' does not cause a memory leak? I examined the source code for boost and noticed that it has two different versions of the constructor: one with shared_ptr and the other that uses weak_ptr. Can someone explain how this works and why this line is write-safe?
source share