Better HN
topnewbestaskshowjobs
Log inSign up

aslmq

1 karma · joined Jul 2, 2024 (2y ago) · 1 submissions

Submissions

comment 2y ago · link · parent

unique_ptr is often too restricted. If you have a simple tree with unique_ptr, already the back edges need to be raw pointers to avoid cycles.

If you add an iterator, the iterator needs internal pointers to the nodes, so by definition the node pointers are not unique. Again, raw pointers are better.

I have never seen a complex data structure where unique_ptr is really used.