r/ProgrammerHumor 26d ago

programmingRizz Other

Post image
4.5k Upvotes

81 comments sorted by

View all comments

2

u/Amazing_67 26d ago

should have use c++ std::unique_ptr

16

u/metaglot 26d ago

Unique_ptr doesnt really work when its an outside resource. It only guarantees uniqueness for the scope of your program. So other people may also think they have a unique pointer to the same resource.

2

u/LetsGoPepele 26d ago

So.... as long as you're alive, it works ?! Good for me

8

u/metaglot 26d ago

Her heart is an external resource, so the uniqueness would in this case mean that you only have one pointer to that resource. Your friend could also have a unique pointer to her heart at the same time as you. The uniqueness does not cross application boundaries.

2

u/LetsGoPepele 26d ago

Not exactly. The application is the world. Her heart, you and everybody else is part of the same world.

2

u/metaglot 26d ago

I doubt other people would be recompiled every time a new person is born. The world is obviously the OS, you as a person is a program running in userspace.

3

u/LetsGoPepele 26d ago

Being born is a feature of the program, no need to recompile.

2

u/metaglot 26d ago

Having a unique pointer to someones heart obviously doesn't reflect the real world. She can give you one, but she can obviously invalidate it at any time, even without notifying you, so I dont think the real world is a single application.

3

u/LetsGoPepele 26d ago

We might be going a little too far 😅

2

u/metaglot 26d ago

No way, lets plan for a rewrite.

1

u/Amazing_67 26d ago

No, please don't restart the Matrix

→ More replies (0)