/* [wolfdan@cloud cpp]$ g++ A.cpp -o A.o -g --std=c++11 [wolfdan@cloud cpp]$ ./A.o 10 before reset: 2 after reset: 0 expired ? : 0 after reset: 0 0x13af028 10 not expired, sleep 1s... not expired, sleep 1s... not expired, sleep 1s... ^C [wolfdan@cloud cpp]$ uname -a Linux cloud 3.10.0-1127.el7.x86_64 #1 SMP Tue Mar 31 23:36:51 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux [wolfdan@cloud cpp]$ g++ --version g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39) Copyright (C) 2015 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. [wolfdan@cloud cpp]$ g++ A.cpp -o A.o -g --std=c++11 [wolfdan@cloud cpp]$ ./A.o 10 before reset: 2 after reset: 0 after reset: sptr count 1 after sptr reset: sptr count 0 expired ? : 1 after reset: 0 weak_ptr is invalid weak_ptr is invalid */