|
Boost : |
From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2005-04-26 16:17:02
"Howard Hinnant" <hinnant_at_[hidden]> wrote in message
news:9ad77ce45f95bed2e20ddc3e0f66ed9d_at_twcny.rr.com...
| On Apr 26, 2005, at 12:08 PM, David Abrahams wrote:
| Why not just a clone_ptr<T> which calls clone on copy construction /
| assignment? Then you could std::container<clone_ptr<T>>. And such a
| container is copyable (clones on copy). An indirection iterator
| adaptor could ease use of this container with algorithms, as could
| indirect comparitors.
See this is where we have different views: I dislike any confusion between
copying
and cloning and hiding one of them under the syntax of the other is just plain
wrong IMO.
They are conceptually different, just like copying and moving are different
and just like
value-based programming is different from OO-programming.
| std::list<clone_ptr<T>> might be the container of choice in the short
| term since list doesn't copy around its elements at the drop of a hat.
|
| In C++0X, (I believe) none of the containers will unnecessarily copy
| clone_ptr's, choosing to internally move them instead (moving a
| clone_ptr would be cheap).
|
| On your thesis: The library should only support copying and assignment
| of pointer containers using the usual copy/assignment syntax if a
| non-destructive copy of the pointer can be made.
for a sufficiently weak definition of copying, then sometimes it will be
possible, sometimes
it won't.
-Thorsten
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk