Support building against LLVM's libc++ 18
libc++ 18 by default removes unique() in 'std::shared_ptr' (in <memory>), as
a follow-up to this resolution:
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0521r0.html
The stated reasoning behing unique()'s deprecation is that testing for
a particular value of use_count() is unsafe if the 'shared_ptr' is used in
parallel by more than one thread without proper synchronization.
Assuming this is not the case here, replace the existing calls by their current
meaning using use_count() (which is not deprecated).
An alternative would be to get unique() back by defining
_LIBCPP_ENABLE_CXX20_REMOVED_SHARED_PTR_UNIQUE before including the libc++
headers, but trying to fight the standard may not be a wise move going forward,
especially if/as other C++ libraries follow suit.