Make the code example c++20 compliant (#8177)

This commit is contained in:
Piotr Idzik
2025-02-09 05:32:46 +00:00
committed by GitHub
parent 932b513d98
commit 8ed47a2e71
@@ -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<std::string>(*data);
std::cout << "Copy is actually made for writing." << std::endl;
}