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

If I need the lifetime of an object to outlive it's presence in the map then I use boost intrusive or simply a map of (smart) pointers.

For me it is usually when I need a multi indexed map where I use a fast map of pointers for the fast access and unordered_map both to keep the object alive and as a secondary access key.

Really I should use boost intrusive or boost multiindex, but these days I value the implementation simplicity in many cases, even if I have to keep the indices in sync myself



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

Search: