From 7ea5ed182edf7b4b7aa3a7ce493cc4abc933f522 Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Thu, 30 Mar 2023 15:44:14 +0530 Subject: [PATCH] src: remove usage of `std::shared_ptr::unique()` `std::shared_ptr::unique()` has been removed in C++20, so this change uses `std::shared_ptr::use_count()` instead which is available in C++20. Fixes: https://github.com/nodejs/node/issues/47311 Signed-off-by: Darshan Sen --- src/node_threadsafe_cow-inl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node_threadsafe_cow-inl.h b/src/node_threadsafe_cow-inl.h index 875b38766063f6..1cd0055ed8079f 100644 --- a/src/node_threadsafe_cow-inl.h +++ b/src/node_threadsafe_cow-inl.h @@ -7,7 +7,7 @@ namespace node { template T* CopyOnWrite::write() { - if (!data_.unique()) { + if (data_.use_count() > 1l) { data_ = std::make_shared(*data_); } return data_.get();