|
Boost : |
From: Andrei Alexandrescu (andrewalex_at_[hidden])
Date: 2002-01-26 13:34:30
Here are some comments on the recently posted "ptr.h" header file:
0.5. new_create::create has a spurious void. This is really just a nit.
1. Class pointer_base is inherited from but doesn't protect against wrongful
deletion.
2. copy_ptr is as susceptible to be wrongful to be useless. It silently
slices polymorphic objects.
3. auto_ptr is wrong, it should use the Colvin-Gibbons trick for proper copy
construction.
3.5. new_delete ought to be new_create (I guess). Again, just a nit.
4. The customization of "Index" and maybe ICP in refcount_ptr are
questionable and risk to complicate a full-fledged smart pointer definition
quite some. I understand the intent is to keep things manageable. An
unsigned int for Index would work quite fine I think. (Anyway, that should
be the default option for Index.) Then, use_count uses a cast to int instead
of using the Index type.
Andrei
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk