220 10741 <DDB9407A-4E7F-4DC5-90F4-58DCC5E287FC@gmail.com> article
Path: news.gmane.org!not-for-mail
From: David Krauss <potswa@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Core Issue: deleted templates
Date: Thu, 22 May 2014 18:10:42 +0800
Lines: 53
Approved: news@gmane.org
Message-ID: <DDB9407A-4E7F-4DC5-90F4-58DCC5E287FC@gmail.com>
References: <a95232ae-71bc-41cc-ad52-511fa4aab43a@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.2\))
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: ger.gmane.org 1400753463 26568 80.91.229.3 (22 May 2014 10:11:03 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Thu, 22 May 2014 10:11:03 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCW25A7E3QCRBK4266NQKGQEJAPUURY@isocpp.org Thu May 22 12:10:56 2014
Return-path: <std-proposals+bncBCW25A7E3QCRBK4266NQKGQEJAPUURY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ie0-f199.google.com ([209.85.223.199])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCW25A7E3QCRBK4266NQKGQEJAPUURY@isocpp.org>)
	id 1WnPxd-0006zW-Hp
	for gclcip-std-proposals@m.gmane.org; Thu, 22 May 2014 12:10:53 +0200
Original-Received: by mail-ie0-f199.google.com with SMTP id rl12sf15098312iec.2
        for <gclcip-std-proposals@m.gmane.org>; Thu, 22 May 2014 03:10:52 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:mime-version:subject:from:in-reply-to:date
         :message-id:references:to:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe:content-type:content-transfer-encoding;
        bh=qnEMmJ7A2WMbF8HM3loHlyjVfULimQt1vlFeQm6T1QI=;
        b=PwQIi7wwEMG4ad/sXOf1Ax7tp36VMxpDRIluTWlxpriCNyycpbAjQc9NUL5ToowA4m
         EUzIditG8daibySjg3R2N/VJQO6ns8G53pF1cZ73OBvmhki1ZwsuIosn0SDDkKLkxJmS
         +JlvhgKc0YHSCmYMkB+1uazrmnFGBCXo4RNTPK1D+YqNETYI3LH0v0uDrlnDRrGz6/rv
         lT5gIrIQoh+RTkctF44MlDTYAq2ysXYdHwHDDarvFwxBDhWU/CH4CMhWhPuDEErYUgF/
         wWTI7ETZxultEVb6kTH7ob78Z4hjkgAgvT1gC2YL/tSkWHy1mQ2S1kuxsnFZNsrBO2Y8
         lB3g==
X-Gm-Message-State: ALoCoQkxlmzsfiEsum65wP6Z48bRb0l76kTiBbw6rYA/FbzBVMM7KXnicBoZGyo6/sOUHSdFuhR/
X-Received: by 10.182.22.133 with SMTP id d5mr25653737obf.27.1400753452650;
        Thu, 22 May 2014 03:10:52 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.50.239.131 with SMTP id vs3ls2685910igc.16.canary; Thu, 22 May
 2014 03:10:51 -0700 (PDT)
X-Received: by 10.42.98.1 with SMTP id q1mr1339678icn.85.1400753451713;
        Thu, 22 May 2014 03:10:51 -0700 (PDT)
Original-Received: from mail-ie0-x22e.google.com (mail-ie0-x22e.google.com [2607:f8b0:4001:c03::22e])
        by mx.google.com with ESMTPS id i1si5414308igt.24.2014.05.22.03.10.51
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Thu, 22 May 2014 03:10:51 -0700 (PDT)
Received-SPF: pass (google.com: domain of potswa@gmail.com designates 2607:f8b0:4001:c03::22e as permitted sender) client-ip=2607:f8b0:4001:c03::22e;
Original-Received: by mail-ie0-f174.google.com with SMTP id lx4so3195098iec.5
        for <std-proposals@isocpp.org>; Thu, 22 May 2014 03:10:51 -0700 (PDT)
X-Received: by 10.42.93.193 with SMTP id y1mr42370674icm.12.1400753451642;
        Thu, 22 May 2014 03:10:51 -0700 (PDT)
Original-Received: from [172.20.10.2] ([121.54.54.132])
        by mx.google.com with ESMTPSA id mk2sm12248426igb.8.2014.05.22.03.10.49
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Thu, 22 May 2014 03:10:50 -0700 (PDT)
In-Reply-To: <a95232ae-71bc-41cc-ad52-511fa4aab43a@isocpp.org>
X-Mailer: Apple Mail (2.1878.2)
X-Original-Sender: potswa@gmail.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of potswa@gmail.com designates 2607:f8b0:4001:c03::22e as permitted
 sender) smtp.mail=potswa@gmail.com;       dkim=pass header.i=@gmail.com;
       dmarc=pass (p=NONE dis=NONE) header.from=gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <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: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:10741
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/10741>


On 2014-05-22, at 5:46 PM, Douglas Boffey <douglas.boffey@gmail.com> wrote:

> Would it not be better if we could explicitly delete the general template=
, thus:
> =20
> template <typename T>
> class Foo =3D delete;

This really should work. I kept writing it for some time in 2011, until fin=
ally I remembered that delete is only for functions.

Note, if it's a serious API issue, you can accomplish something better usin=
g static_assert with a fake type-dependency:

template< typename T >
class Foo {
    static_assert( std::is_same< T, void >::value, "Invalid template argume=
nt." );
};

This can be encapsulated in a pseudo-CRTP base class, although it makes the=
 diagnostic less user-friendly.

>  Likewise for template functions and template variables.

It already works for function templates.

Much the same thing can be accomplished by declaring a variable template wi=
th a type that cannot be constructed, hence generating an error at the offe=
nding instantiation. Disabling an explicit specialization of a variable tem=
plate might not be as elegant, but you can probably use SFINAE in the prima=
ry template instead. (Or concepts, once we get those.)

In principle, though, I suppose you're right about variable templates.

>   Foo &operator=3D(const T &t) =3D delete; // Are we deleting the templat=
e or the member function?

There is no distinction. Deleted functions produce an error when selected b=
y overload resolution.

--=20

---=20
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 e=
mail 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-proposa=
ls/.

.
