Make the code example c++20 compliant (#8177)
This commit is contained in:
1 parent
932b513d98
commit
8ed47a2e71
1 file changed
+1
-1
@@ -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;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user