Article View: comp.std.c++
Article #3188Re: Why no allocator-specific delete?
From: Matt Timmermans
Date: Thu, 01 Feb 1996 17:26
Date: Thu, 01 Feb 1996 17:26
49 lines
2546 bytes
2546 bytes
(kanze@lts.sel.alcatel.de (James Kanze US/ESC 60/3/141 #40763))
| In article <4e85k6$b04@noc.tor.hookup.net> mtimmerm@microstar.com
| (Matt Timmermans) writes:
|
| | ... I can't, in fact, think of a single way that
| | placement-new could be used properly.
|
| [two decent uses described]
|
| | The lack of a placement-delete is on of the many factors in C++ conspiring
| | to make it absolutely impossible to make generic collections that hold
| | actual objects (with constructors) instead of just pointers.
| I don't understand the problem. My containers all contain actual
| objects, and not just pointers.
I spoke somewhat too generally. Let's say I want to make a generic list:
template <class T> class ListOf;
which stores acutal objects of type T (not just pointers) and contains
methods to add and delete items from the list. Lets say I also have a
class:
class A
{
...
public:
A(int alpha,int beta);
~A();
};
Note that class A has no valid copy semantics. How can I implement ListOf
such that ListOf<int> and ListOf<A> both work? There are lots of slimy
hacks, but no elegant solutions.
</Matt>
--------------------------------------------------------------
Matt Timmermans | Phone: +1 613 596-2233
Microstar Software Ltd. | Fax: +1 613 596-5934
3775 Richmond Rd. | E-mail: mtimmerm@microstar.com
Nepean Ontario CANADA K2H 5B7 | http://www.microstar.com
---
[ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu.
Contact address: std-c++-request@ncar.ucar.edu. The moderation policy
is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID:
<4eqn5b$les@noc.tor.hookup.net>Path:
arc1-ca.pugleaf.net!fido.asd.sgi.com!austernReferences:
<4dvid8$460@news.bridge.net> <4e0u1s$5fv@engnews1.Eng.Sun.COM> <4e85k6$b04@noc.tor.hookup.net> <KANZE.96Jan29095513@slsvewt.lts.sel.alcatel.de>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!fido.asd.sgi.com!austern From: mtimmerm@microstar.com (Matt Timmermans) Newsgroups: comp.std.c++ Subject: Re: Why no allocator-specific delete? Date: 01 Feb 1996 09:26:44 PST Organization: Microstar Software Ltd. Approved: austern@isolde.mti.sgi.com Message-ID: <4eqn5b$les@noc.tor.hookup.net> References: <4dvid8$460@news.bridge.net> <4e0u1s$5fv@engnews1.Eng.Sun.COM> <4e85k6$b04@noc.tor.hookup.net> <KANZE.96Jan29095513@slsvewt.lts.sel.alcatel.de> NNTP-Posting-Host: isolde.mti.sgi.com X-Original-Date: Thu, 01 Feb 1996 15:45:57 GMT X-Newsreader: Forte Free Agent v0.55 X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBVAwUBMRD360y4NqrwXLNJAQFyMwH/b1Zm9AssDyrf4wsP4mJx6JDPbEI8wF58 soNntttb4ukBX4+Gv1gnjiZIuBJ9uYSt53E7J2MfV0ht8WnLRtrEgQ== =ltaq Originator: austern@isolde.mti.sgi.com