Opened 12 years ago
Closed 12 years ago
#4796 closed Bugs (wontfix)
Empty shared_ptr_nmt returns use_count() = 1
Reported by: | Owned by: | Peter Dimov | |
---|---|---|---|
Milestone: | To Be Determined | Component: | smart_ptr |
Version: | Boost 1.44.0 | Severity: | Problem |
Keywords: | Cc: |
Description
If you construct an empty shared_ptr, the use_count() method will return 0. This is indicated in the documentation as "Postconditions: use_count() == 0 && get() == 0."
If I look at the implementation in boost/smart_ptr/detail/shared_ptr_nmt.hpp, the default constructed shared_ptr will create a count_type(1). That means that use_count() will return 1 even if I construct it without any initial value. This is inconsistent IMHO.
Change History (4)
comment:1 by , 12 years ago
comment:3 by , 12 years ago
I propose this ticket should be closed indeed. The explanation that this is a no longer tested/used version of shared_ptr is sufficient for me. Your development time is probably best spent on the more recent version. Thanks for the acknowledgement though :)
comment:4 by , 12 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
Yes, I suppose it is. shared_ptr_nmt.hpp (nmt - no member templates), however, is no longer used by any of the compilers with which Boost is tested.