220 5344 <CAGNvRgB6xC8LmtnmyVC5UOcHWbKvBKCabte_tzJ+X6Tae3FEPw@mail.gmail.com> article
Path: news.gmane.org!not-for-mail
From: =?ISO-8859-1?Q?Daniel_Kr=FCgler?= <daniel.kruegler@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Allowing any integral type as an argument for
 user defined operators
Date: Mon, 8 Jul 2013 19:37:35 +0200
Lines: 53
Approved: news@gmane.org
Message-ID: <CAGNvRgB6xC8LmtnmyVC5UOcHWbKvBKCabte_tzJ+X6Tae3FEPw@mail.gmail.com>
References: <f53bf704-c97f-41c9-adac-61f9eb59c609@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
Content-Transfer-Encoding: quoted-printable
X-Trace: ger.gmane.org 1373305058 25715 80.91.229.3 (8 Jul 2013 17:37:38 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Mon, 8 Jul 2013 17:37:38 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCT7RVFA4QORBYHR5OHAKGQE4FY3K2Y@isocpp.org Mon Jul 08 19:37:40 2013
Return-path: <std-proposals+bncBCT7RVFA4QORBYHR5OHAKGQE4FY3K2Y@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-bk0-f72.google.com ([209.85.214.72])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCT7RVFA4QORBYHR5OHAKGQE4FY3K2Y@isocpp.org>)
	id 1UwFNb-0000nZ-Sr
	for gclcip-std-proposals@m.gmane.org; Mon, 08 Jul 2013 19:37:39 +0200
Original-Received: by mail-bk0-f72.google.com with SMTP id jc3sf4602324bkc.11
        for <gclcip-std-proposals@m.gmane.org>; Mon, 08 Jul 2013 10:37:39 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=x-beenthere:mime-version:in-reply-to:references:date:message-id
         :subject:from:to:x-original-sender:x-original-authentication-results
         :reply-to:precedence:mailing-list:list-id:x-google-group-id
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe
         :content-type:content-transfer-encoding;
        bh=1PPI2ST8PPwJNfB0TbxYT4XAqBwqOCdemQocBPW1Wuk=;
        b=TUL+cCBALSZB8K+VHLUeaqGozQwloJHAGBd+keXPrxcs2mYgSuRW1Guedyt5kmUAo6
         7VCiP4R19oj9zQ4DyhH9viWe2NSB0LSt7y+LoPjTnIUjNozRE6pVKZ/TJzoUhxuwQOP4
         JKiWqJjTsartIb1CdNZf/t+wFA9MxRbn/dLcKBBhdVNB7DxVsNcAW/rcoCiXvt23SIyJ
         dEvPVZgeIpOWVmcmbfC02t4SCruy7jFQeJ5Dn6xwRI2Bvn9YgGVC0ENRP+1CofO3Oqvp
         fKoO9J7SyDyzlPatqu15rUsaMYe17WiMQ+M/dnUfz2+bkYkE5XFR05VFBnVPQ03q16CF
         8JCA==
X-Received: by 10.180.36.211 with SMTP id s19mr19838960wij.1.1373305059289;
        Mon, 08 Jul 2013 10:37:39 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.181.12.101 with SMTP id ep5ls2215921wid.15.canary; Mon, 08 Jul
 2013 10:37:35 -0700 (PDT)
X-Received: by 10.194.93.74 with SMTP id cs10mr12938132wjb.9.1373305055878;
        Mon, 08 Jul 2013 10:37:35 -0700 (PDT)
Original-Received: from mail-we0-x22a.google.com (mail-we0-x22a.google.com [2a00:1450:400c:c03::22a])
        by mx.google.com with ESMTPS id lm2si14754809wic.68.2013.07.08.10.37.35
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Mon, 08 Jul 2013 10:37:35 -0700 (PDT)
Received-SPF: pass (google.com: domain of daniel.kruegler@gmail.com designates 2a00:1450:400c:c03::22a as permitted sender) client-ip=2a00:1450:400c:c03::22a;
Original-Received: by mail-we0-f170.google.com with SMTP id w57so3976917wes.29
        for <std-proposals@isocpp.org>; Mon, 08 Jul 2013 10:37:35 -0700 (PDT)
X-Received: by 10.180.38.45 with SMTP id d13mr12138614wik.62.1373305055531;
 Mon, 08 Jul 2013 10:37:35 -0700 (PDT)
Original-Received: by 10.216.82.66 with HTTP; Mon, 8 Jul 2013 10:37:35 -0700 (PDT)
In-Reply-To: <f53bf704-c97f-41c9-adac-61f9eb59c609@isocpp.org>
X-Original-Sender: daniel.kruegler@gmail.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of daniel.kruegler@gmail.com designates 2a00:1450:400c:c03::22a as
 permitted sender) smtp.mail=daniel.kruegler@gmail.com;       dkim=pass header.i=@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:5344
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/5344>

2013/7/6 Micha=C5=82 Dominiak <griwes@griwes.info>:
> Today I came across a really silly problem - you cannot take `uint64_t` a=
s
> an argument of a user defined operator, because it's commonly a typedef f=
or
> `unsigned long`, not `unsigned long long` - even though they are both 64 =
bit
> on most sane ABIs, you cannot use `uint64_t` as type of `operator""`. I h=
ope
> we all agree it's a silly situation.
>
> So, I would like to propose to allow `operator""` use any integral type a=
s
> its argument type.
>
> There obviously could be a problem of the parameter being bigger than
> `numeric_limits<type>::max()`, which can be solved by issuing an error, l=
ike
> here:
>
> constexpr uint64_t operator""_foo(uint8_t); // limit X in X_foo to range =
of
> 0..255
> auto bar =3D 256_foo; // error: integer constant is too large for its typ=
e
>
> And we'd also get free limit checking as a nice side effect. Thoughts?
>
> PS If the fact you can only use `unsigned long long` has some deeper
> reasoning I fail to see, I would welcome any explanation for it, but, as =
I
> said, I fail to see any benefits of disallowing integral types other than
> `unsigned long long` (or "the biggest integral type available").

Presumably there is some overlap with the existing core language issue

http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1266

- Daniel

--=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/.



.
