Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-04-27 04:52:11

From: "Gennadiy Rozental" <rogeeff_at_[hidden]>
> 9. I checked current smart_ptr_test.cpp using my generators. With
> of missing operator[] all test are passing (well, 3 are failing but this
> because I have for smart_ptr<...> v => v.use_count() = 0, while current
> implementation gives 1. Is there specific reason why is that? )

use_count() is the number of shared_ptr copies in existence.

shared_ptr<int> v; // v.use_count() == 1
shared_ptr<int> v2(v); // v.use_count() == 2

use_count() == 0 means no shared_ptr objects; this is only possible when you
check the use_count() via a weak_ptr.

Boost list run by bdawes at, gregod at, cpdaniel at, john at