Solved: 34 - Smart Pointers

This commit is contained in:
2026-08-18 07:03:07 +03:00
parent d26d32a245
commit 0a0c430ebe
+7 -6
View File
@@ -3,18 +3,19 @@
namespace cpp11 {
auto make_counter(int start) -> std::unique_ptr<int> {
(void)start;
return nullptr;
return std::make_unique<int>(start);
}
auto shared_total(const std::vector<std::shared_ptr<int>>& values) -> int {
(void)values;
return 0;
int total = 0;
for (const auto& value : values) {
total += *value;
}
return total;
}
auto clone_unique(const std::unique_ptr<int>& value) -> std::unique_ptr<int> {
(void)value;
return nullptr;
return std::make_unique<int>(*value);
}
} // namespace cpp11