|
Boost : |
From: Angus Leeming (angus.leeming_at_[hidden])
Date: 2004-01-08 10:24:53
David Abrahams wrote:
>> I have this code that use shared_ptr<>::use_count() to
>> ascertain whether to remove an item from a cache:
>>
>> Is that the sort of thing you are interested in?
>
> Yep, but unique is not quite the same as use_count.
I guess that I wrote the code without noticing unique()s existence.
However, I now know of it (thanks ;-) and have checked the code in
boost/detail/shared_count.hpp:
bool unique() const // nothrow
{
return use_count() == 1;
}
I find that this is exactly what I use myself, so will modify my code
to use shared_ptr<>::unique().
Regards,
Angus
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk