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: #47311
Signed-off-by: Darshan Sen <[email protected]>
PR-URL: #47315
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: Jiawen Geng <[email protected]>
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
RaisinTen authored and RafaelGSS committed Apr 5, 2023
1 parent 69a98a5 commit 26a199b
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 26a199b

Please sign in to comment.