Skip to content
CodeWiki
Practice
Paths
Tracks
Cheatsheets
Playground
Glossary
AI era
Search
⌘K
English
English
Chinese
Practice
Paths
Tracks
Cheatsheets
Playground
Glossary
AI era
English
English
Chinese
Practice
/
Quiz
/
C++
/
Smart pointers
What happens when a shared_ptr is copied?
from Smart pointers
C++23 (GCC 13.3.0)
beginner
1 min
What happens when a shared_ptr is copied?
The copy joins the same control block and becomes another strong owner.
The managed object is deep-copied into a separate allocation.
The source becomes empty, exactly like moving a unique_ptr.
Every weak_ptr is converted into a strong owner.
Check
Ask AI about this kata
Report an error
previous kata
Repair generated worker callbacks
Review AI code
next kata
Which C++23 statement about shared_ptr and threads is correct?
Quiz
A new version is available
Reload