Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 409158a

Browse files
committedMar 30, 2023
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 <[email protected]>
1 parent 67660e8 commit 409158a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed
 

‎src/node_threadsafe_cow-inl.h

+1-1
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)
Please sign in to comment.