$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Peter Dimov (pdimov_at_[hidden])
Date: 2003-02-10 11:35:03
dynalink wrote:
> Forgive me if this seems like a really basic question, but how does
> one create a shared_ptr with an initial use count of zero?
There is no way to create a shared_ptr with use_count of zero. Use_count()
returns the number of shared_ptr instances sharing ownership. Use_count() ==
0 means that there are is no shared_ptr instance. If you are able to call
shared_ptr::use_count(), you have a(t least one) shared_ptr.
Zero can only be returned from weak_ptr::use_count(), and this means that
all shared_ptr's have been destroyed.
Why do you ask?