Bloomberg LP Interview Question Software Engineer / Developers
- 0of 0 votes
why do we need weak_ptr? give an example by code!
I didn't answer the question well.
I am really confused about weak_ptr. weak_ptr is an observer of shared_ptr, meaning that we always need shared_ptr in order to use weak_ptr. but in cyclic case, we don't use shared_ptr for one of the object, then in this case how can we use weak_ptr without shared_ptr to break cycle?
Country: United States
Interview Type: In-Person