mirror of
https://github.com/szymon-jozef/ZUT-notatki.git
synced 2026-10-28 11:10:38 +01:00
rzeczy
This commit is contained in:
16
uczelnia/2_semestr/programowanie/laby/lab5/zad8.cpp
Normal file
16
uczelnia/2_semestr/programowanie/laby/lab5/zad8.cpp
Normal 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'; // ?
|
||||
}
|
||||
Reference in New Issue
Block a user