Hacker Timesnew | past | comments | ask | show | jobs | submitlogin

I think this is not right -- since references aren't reseatable, this would effectively make the data structure (but not necessarily its contents) immutable.

Shared pointers or raw pointers are the options that make most sense, in my opinion.

Edit: forgot to say, if you use shared_ptr beware circular references. e.g. in the case of a doubly linked list. weak_ptr could be used to break the cycle, but I'd probably use raw pointers here.



Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: