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; }