Skip to content

Commit 7ea5ed1

Browse files
committed
src: remove usage of std::shared_ptr<T>::unique()
`std::shared_ptr<T>::unique()` has been removed in C++20, so this change uses `std::shared_ptr<T>::use_count()` instead which is available in C++20. Fixes: #47311 Signed-off-by: Darshan Sen <raisinten@gmail.com>
1 parent 67660e8 commit 7ea5ed1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/node_threadsafe_cow-inl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace node {
77

88
template <typename T>
99
T* CopyOnWrite<T>::write() {
10-
if (!data_.unique()) {
10+
if (data_.use_count() > 1l) {
1111
data_ = std::make_shared<T>(*data_);
1212
}
1313
return data_.get();

0 commit comments

Comments
 (0)