This commit is contained in:
2026-03-31 15:01:08 +02:00
parent c9945fb1d3
commit 3a5efebd4b
12 changed files with 88 additions and 1 deletions

View File

@@ -0,0 +1,16 @@
// Prześledź poniższy kod. Przed każdym std::cout przewidź wartość use_count(), a nast
// pnie uruchom program i porównaj
#include <iostream>
#include <memory>
int main() {
auto a = std::make_shared<int>(42);
std::cout << a.use_count() << '\n'; // ?
{
auto b = a;
std::cout << a.use_count() << '\n'; // ?
auto c = a;
std::cout << a.use_count() << '\n'; // ?
}
std::cout << a.use_count() << '\n'; // ?
}