|
Boost : |
From: Nicolas Fleury (nidoizo_at_[hidden])
Date: 2003-12-24 12:50:15
Thorsten Ottosen wrote:
> Feedback is welcome.
I just want to tell you that I am very interested in your library.
Right now, when I want a container to have ownership of pointers, I
basically have the choice between complicate the usage (not that much
but still) and handle the ownership by hand, which can be error-prone,
particularly if code deleting elements is added. I usually choose to
store shared_ptrs, but it complicates for nothing the creation of all
added elements in context when the elements are not actually *shared*.
Your solution would be something very simple to explain to my collegues
and adds no burden to creation of elements. If it is someday in Boost,
I would use it right away.
I think the const-copy semantic of elements in STL containers is
basically forcing to use shared_ptrs even when elements are not shared,
so I think your solution of having equivalent containers for pointers is
the good solution.
Like others pointed, I think you example could be more convincing. You
should show how it simplifies everything in day-to-day work with
basically all operations.
About ptr_map, I wonder if a map with the key a pointer should be
provided (and another with both key and value pointers). Same thing for
multimap.
About releasing functions returning auto_ptrs and adopting ones taking
one, even if I have used this convention before, I feel it is far from
standard and I don't remember having seeing it in Boost. It is however
more safe.
Regards,
Nicolas Fleury
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk