Skip to content

Commit

Permalink
src: remove usage of std::shared_ptr<T>::unique()
Browse files Browse the repository at this point in the history
`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: nodejs#47311
Signed-off-by: Darshan Sen <raisinten@gmail.com>
  • Loading branch information
RaisinTen committed Mar 30, 2023
1 parent 67660e8 commit 409158a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/node_threadsafe_cow-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace node {

template <typename T>
T* CopyOnWrite<T>::write() {
if (!data_.unique()) {
if (data_.use_count() > 1l) {
data_ = std::make_shared<T>(*data_);
}
return data_.get();
Expand Down

0 comments on commit 409158a

Please sign in to comment.