From 8ed47a2e715fe7697283c438f0135aa8a24f841a Mon Sep 17 00:00:00 2001 From: Piotr Idzik <65706193+vil02@users.noreply.github.com> Date: Sun, 9 Feb 2025 06:32:46 +0100 Subject: [PATCH] Make the code example `c++20` compliant (#8177) --- src/data/roadmaps/cpp/content/112-idioms/106-copy-write.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/data/roadmaps/cpp/content/112-idioms/106-copy-write.md b/src/data/roadmaps/cpp/content/112-idioms/106-copy-write.md index 9aa6e53ac..b1ee61400 100644 --- a/src/data/roadmaps/cpp/content/112-idioms/106-copy-write.md +++ b/src/data/roadmaps/cpp/content/112-idioms/106-copy-write.md @@ -20,7 +20,7 @@ public: // Make a copy only if we want to modify the data. void write(const std::string &str) { // Check if there's more than one reference. - if(!data.unique()) { + if(data.use_count() > 1) { data = std::make_shared(*data); std::cout << "Copy is actually made for writing." << std::endl; }