220 19153 <1878113.RIILQpcz1G@tjmaciei-mobl4> article
Path: news.gmane.org!not-for-mail
From: Thiago Macieira <thiago@macieira.org>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: New type of "new"/"delete" override
Date: Tue, 21 Jul 2015 17:14:50 -0700
Lines: 37
Approved: news@gmane.org
Message-ID: <1878113.RIILQpcz1G@tjmaciei-mobl4>
References: <2328a5fd-924c-4d02-ac18-6a225f786dec@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
X-Trace: ger.gmane.org 1437524105 16914 80.91.229.3 (22 Jul 2015 00:15:05 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Wed, 22 Jul 2015 00:15:05 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCB4TK757YBRB7OAXOWQKGQEOGIOCVI@isocpp.org Wed Jul 22 02:14:56 2015
Return-path: <std-proposals+bncBCB4TK757YBRB7OAXOWQKGQEOGIOCVI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-wi0-f199.google.com ([209.85.212.199])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCB4TK757YBRB7OAXOWQKGQEOGIOCVI@isocpp.org>)
	id 1ZHhgV-0004aZ-FE
	for gclcip-std-proposals@m.gmane.org; Wed, 22 Jul 2015 02:14:55 +0200
Original-Received: by wicmm11 with SMTP id mm11sf10838769wic.3
        for <gclcip-std-proposals@m.gmane.org>; Tue, 21 Jul 2015 17:14:54 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:from:to:subject:date:message-id:user-agent
         :in-reply-to:references:mime-version:content-type:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=e0vKCxWZUDWTBHxsrwGU8IfvQu85l1xVA+E68VA01Lo=;
        b=TU7IJwV1+R4z7Fqz6bkHxl6tX/V6CWHcT5uLvlJ/BZcXgELU2CL5E+QsqCUvFq7gEd
         YCYOchmUSzU1/itroGLCxgmcPqVu479Ygkv9JJ8jUQRhb+8uiq1LDBIoo4Sn3bdfffA5
         OemaGcx1Jg8cKCLU5Ok339yNlenCV99TXN6mHzR9FxE+dObJwympyyBWw6AkbCZdy9sc
         jpC8aWTIwl0zxFZ+a7ykvWUmNkytNS0D/GagjGSU9nCdauIq4Lyem5Tk7kCrFcTPt1R3
         NjZbSMR8Aeu2RRf6kaWorrhxU2StJfJS6X8w/9nvQEMlD25HO7SbUboX0aMeaclBcWxC
         bK1w= 
X-Gm-Message-State: ALoCoQkF+3rMsMAHtOfBP6NEXRHHeFge7Aok8ZYjOh5T9jZxuziXqJFTUVojjmlcjoOtDJOnlOpA
X-Received: by 10.112.14.101 with SMTP id o5mr18996838lbc.3.1437524094777;
        Tue, 21 Jul 2015 17:14:54 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.180.92.101 with SMTP id cl5ls39360wib.16.gmail; Tue, 21 Jul
 2015 17:14:53 -0700 (PDT)
X-Received: by 10.194.104.98 with SMTP id gd2mr67684003wjb.35.1437524093227;
        Tue, 21 Jul 2015 17:14:53 -0700 (PDT)
Original-Received: from gondolin.macieira.info (gondolin.macieira.info. [78.47.120.188])
        by mx.google.com with ESMTP id u10si652129wix.24.2015.07.21.17.14.53
        for <std-proposals@isocpp.org>;
        Tue, 21 Jul 2015 17:14:53 -0700 (PDT)
Received-SPF: pass (google.com: domain of thiago@macieira.org designates 78.47.120.188 as permitted sender) client-ip=78.47.120.188;
Original-Received: from tjmaciei-mobl4.localnet (jfdmzpr06-ext.jf.intel.com [134.134.137.75])
	by gondolin.macieira.info (Postfix) with ESMTPSA id 67BC611A67C
	for <std-proposals@isocpp.org>; Tue, 21 Jul 2015 17:14:52 -0700 (PDT)
User-Agent: KMail/4.14.9 (Linux/4.0.5-3-desktop; KDE/4.14.9; x86_64; ; )
In-Reply-To: <2328a5fd-924c-4d02-ac18-6a225f786dec@isocpp.org>
X-Original-Sender: thiago@macieira.org
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of thiago@macieira.org designates 78.47.120.188 as permitted sender) smtp.mail=thiago@macieira.org
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Spam-Checked-In-Group: std-proposals@isocpp.org
X-Google-Group-Id: 399137483710
List-Post: <http://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <http://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <http://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:19153
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/19153>

On Tuesday 21 July 2015 12:37:40 Myriachan wrote:
> In trying to implement a custom memory allocator, there are many annoyances 
> that come up that make C++ difficult to work with.  Particularly, the
> syntax of the new and delete operators means that using a custom memory
> allocator often involves macros that are semantically different from new
> and delete.  When private and protected constructors and destructors get
> involved, things get especially annoying, because the allocator code can't
> call the constructor or destructor itself.
> 
> I thought of an idea that would help with this issue, though it is 
> admittedly rather crazy.

Besides the need for extra typing, why can't you do:

struct valloc_t {};
extern valloc_t valloc;

void *operator new(std::size_t size, valloc_t);
void operator delete(void *, valloc_t);

And thus:

	auto i = new (valloc) MyObject;
-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358

-- 

--- 
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

.
