From 409158aa786860f001aed5c74b428531c4ebe479 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();