Article View: comp.std.c++
Article #3400Re: proposal: renew & relocator member fn
From: Pablo Halpern
Date: Thu, 22 Feb 1996 15:51
Date: Thu, 22 Feb 1996 15:51
38 lines
2028 bytes
2028 bytes
jbuck@Synopsys.COM (Joe Buck) wrote:
> [Discussion about need for a special relocation constructor/destructor ]
>Consider the template
>
>template<class T>
>T* relocate(T* oldloc, void* newloc) {
> T* result = new(newloc) T(*oldloc);
> oldloc->~T();
>}
>
> [Discussion about how this template be specialized for classes where
relocation could be made cheaper]
>
I like this a lot. I wouldn't mind seeing this added to the standard
library and used in the implementation of STL.
It doesn't solve one problem that realloc() does solve: the ability to
prevent relocation if the allocator is able to grow a block without
relocating it. I believe run-time library support tied to a language
extension is needed if you are to take advantage of an operating-system
capability like that. We can probably live without such a language
extension.
-------------------------------------------------------------
Pablo Halpern phalpern@truffle.ultranet.com
I am self-employed. Therefore, my opinions *do* represent
those of my employer.
[ To submit articles: Try just posting with your newsreader.
If that fails, use mailto:std-c++@ncar.ucar.edu
FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html
Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html
Comments? mailto:std-c++-request@ncar.ucar.edu
]
Technical Details
Message-ID:
<4ghtnb$u0u@caesar.ultra.net>Path:
arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamageReferences:
<GNB.96Feb7140952@dame.bby.com.au> <4fgfpu$oth@hermes.synopsys.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamage From: phalpern@truffle.ultranet.com (Pablo Halpern) Newsgroups: comp.std.c++ Subject: Re: proposal: renew & relocator member fn Date: 22 Feb 1996 15:51:17 GMT Organization: UltraNet Communications, Inc. Approved: clamage@eng.sun.com (comp.std.c++) Message-ID: <4ghtnb$u0u@caesar.ultra.net> References: <GNB.96Feb7140952@dame.bby.com.au> <4fgfpu$oth@hermes.synopsys.com> NNTP-Posting-Host: taumet.eng.sun.com Content-Type: text X-Nntp-Posting-Host: truffle.ultranet.com X-Newsreader: Forte Agent .99b.113 Content-Length: 1050 X-Lines: 31 Originator: clamage@taumet