220 34708 <527c448b-b8dd-4877-b63f-b399c167da4d@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Mingxin Wang <wmx16835vv@163.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Extensions for Disambiguation Tags
Date: Sun, 8 Oct 2017 19:08:01 -0700 (PDT)
Lines: 123
Approved: news@gmane.org
Message-ID: <527c448b-b8dd-4877-b63f-b399c167da4d@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_5111_544801364.1507514881268"
X-Trace: blaine.gmane.org 1507514885 21509 195.159.176.226 (9 Oct 2017 02:08:05 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Mon, 9 Oct 2017 02:08:05 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBDNMBNHJWIGBBAVU5PHAKGQERJ5YF7Q@isocpp.org Mon Oct 09 04:08:01 2017
Return-path: <std-proposals+bncBDNMBNHJWIGBBAVU5PHAKGQERJ5YF7Q@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ua0-f197.google.com ([209.85.217.197])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBDNMBNHJWIGBBAVU5PHAKGQERJ5YF7Q@isocpp.org>)
	id 1e1NU3-0004Fg-UR
	for gclcip-std-proposals@m.gmane.org; Mon, 09 Oct 2017 04:07:56 +0200
Original-Received: by mail-ua0-f197.google.com with SMTP id e46sf15435274uaa.6
        for <gclcip-std-proposals@m.gmane.org>; Sun, 08 Oct 2017 19:08:03 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=date:from:to:message-id:subject:mime-version:x-original-sender
         :reply-to:precedence:mailing-list:list-id:list-post:list-help
         :list-archive:list-subscribe:list-unsubscribe;
        bh=vOb2qk/NEEFIUomqVUjqn0G5SbOjhTPSZYf1LSXBc7s=;
        b=YkHbs18CC/1GKCIXkSRhjy5NUFdqsfp1UxsmZWL2KamtFfqS3pKlpbXVPhwU6zYFZL
         Dswtge0XF+PrNYHuyuam8m3ab0GgdBJMKyu8FtNDdgWPySQJUtVFVZmsLt1jf6eTnTiP
         PIJVRcAtEqfCl2kWsPQmtmoIYOPDMTbQRCAmxJZjEZVRugefQtJFr3x6dZ4auKcKpnLM
         TEmUKjE0JqPQiWsb4euv6ryrg2tiKHDqdoDYFGAJ7iwt+A8nb7rwr7gitCOWlmP5wuQr
         rtRjHRo3PYSxwKG5iRh1IMSNUHGzvFEv3Sd1VfXHSDZNe5OSg9XBE7JxenYutBcKze7+
         X/qw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:date:from:to:message-id:subject:mime-version
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=vOb2qk/NEEFIUomqVUjqn0G5SbOjhTPSZYf1LSXBc7s=;
        b=Gu1uE0HCoKS7XmUO4cftCeK30ma+V6q6vrnG6TQoyOKaf1EBqeUcdf2mMarm0S8DVO
         bQdCGzViIXdIf3rzBfdLg8V4+Iq/u3QaJ5qUjv5mWn1YIF33Jx8hlC5Wm9YGj9HpNKIZ
         ZtuKtIMA+GSjpVdF1N6IFXvnjhLljOG9ogR+5UyM4csB3MBwRXVzZwm+7tlkiHiR+3qk
         KMupXR4f8MoYoF435oh+bLYqHi8ck7d0uuQ0v85/QRRnhOuXuGbN55rhgMIGUAp7uvN4
         eLvswDcrf3x7A1rcYZTXiGt7Xz1ty5cCl/vs/YrvY0y+Xjdv5NCWQs7YhWkVNRUF+1r3
         TA9w==
X-Gm-Message-State: AMCzsaUp4OqHW4d+dJw/ocdmRy24ONzeFwkURJ/N/mlJoMtQQU6t6JTg
	kXzKbe5Dp9y2f9WybNqKiescUA==
X-Google-Smtp-Source: AOwi7QAWB3Tp5pIMvNawJejLD15y4/VeOj0IQ8ZKPWI83l88ZtS79kz4Q+MbfrKH87FEu/IVAPz3EA==
X-Received: by 10.176.20.239 with SMTP id f44mr1741392uae.84.1507514883140;
        Sun, 08 Oct 2017 19:08:03 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.31.60.206 with SMTP id j197ls873907vka.8.gmail; Sun, 08 Oct
 2017 19:08:01 -0700 (PDT)
X-Received: by 10.31.169.76 with SMTP id s73mr394761vke.14.1507514881854;
        Sun, 08 Oct 2017 19:08:01 -0700 (PDT)
X-Original-Sender: wmx16835vv@163.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: <https://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <https://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <https://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <https://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>,
 <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:34708
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/34708>

------=_Part_5111_544801364.1507514881268
Content-Type: multipart/alternative; 
	boundary="----=_Part_5112_1429278779.1507514881268"

------=_Part_5112_1429278779.1507514881268
Content-Type: text/plain; charset="UTF-8"

I think the disambiguation tags defined in the standard are not enough to 
carry every sort of metadata required by function templates, and therefore 
I suggest the following two additional disambiguation tags:

template <class T, T V>
struct in_place_arg_t {
  explicit in_place_arg_t() = default;
};
template <class T, T V>
inline constexpr in_place_arg_t<T, V> in_place_arg {};

template <class T, const T& V>
struct in_place_resource_t {
  explicit in_place_resource_t() = default;
};
template <class T, const T& V>
inline constexpr in_place_resource_t<T, V> in_place_resource {};

Users are allowed to pass constexpr values by `in_place_arg`, and pass 
static constexpr resources by `in_place_resource`.

Additionally, I suggest that `in_place_index_t` should be an alias of 
`in_place_arg_t`:

template <size_t I>
using in_place_index_t = in_place_arg_t<size_t, I>;

Moreover, comparing to `in_place_arg_t`, I think `integral_constant` is 
inappropriately named, and there seem to be little necessity to define any 
member types or constants in it, because these metadata is already passed 
by templates. This design is also considered as a solution to another 
thread "Constexpr function parameters through special conversions 
<https://groups.google.com/a/isocpp.org/forum/#!topic/std-proposals/LANKIrTpaD4>" 
started by Nicol Bolas.

The motivation of this design comes from the implementation of another 
unpublished proposal of mine about polymorphism (I am still working on it), 
and I found it useful when recursively calling constexpr functions in 
non-constexpr ones with custom input.

I am looking forward to your comments and suggestions!

Mingxin Wang

-- 
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.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/527c448b-b8dd-4877-b63f-b399c167da4d%40isocpp.org.

------=_Part_5112_1429278779.1507514881268
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">I think the disambiguation tags defined in the standard ar=
e not enough to carry every sort of metadata required by function templates=
, and therefore I suggest the following two additional disambiguation tags:=
<br><div><br></div><div><div class=3D"prettyprint" style=3D"background-colo=
r: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-style: soli=
d; border-width: 1px; word-wrap: break-word;"><code class=3D"prettyprint"><=
div class=3D"subprettyprint"><font color=3D"#660066"><div class=3D"subprett=
yprint">template &lt;class T, T V&gt;</div><div class=3D"subprettyprint">st=
ruct in_place_arg_t {</div><div class=3D"subprettyprint">=C2=A0 explicit in=
_place_arg_t() =3D default;</div><div class=3D"subprettyprint">};</div><div=
 class=3D"subprettyprint">template &lt;class T, T V&gt;</div><div class=3D"=
subprettyprint">inline constexpr in_place_arg_t&lt;T, V&gt; in_place_arg {}=
;</div><div class=3D"subprettyprint"><br></div><div class=3D"subprettyprint=
">template &lt;class T, const T&amp; V&gt;</div><div class=3D"subprettyprin=
t">struct in_place_resource_t {</div><div class=3D"subprettyprint">=C2=A0 e=
xplicit in_place_resource_t() =3D default;</div><div class=3D"subprettyprin=
t">};</div><div class=3D"subprettyprint">template &lt;class T, const T&amp;=
 V&gt;</div><div class=3D"subprettyprint">inline constexpr in_place_resourc=
e_t&lt;T, V&gt; in_place_resource {};</div></font></div></code></div><br><d=
iv>Users are allowed to pass constexpr values by `in_place_arg`, and pass s=
tatic constexpr resources by `in_place_resource`.</div><div><br></div><div>=
Additionally, I suggest that `in_place_index_t` should be an alias of `in_p=
lace_arg_t`:</div></div><div><br></div><div><div class=3D"prettyprint" styl=
e=3D"background-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187)=
; border-style: solid; border-width: 1px; word-wrap: break-word;"><code cla=
ss=3D"prettyprint"><div class=3D"subprettyprint"><div class=3D"subprettypri=
nt">template &lt;size_t I&gt;</div><div class=3D"subprettyprint">using in_p=
lace_index_t =3D in_place_arg_t&lt;size_t, I&gt;;</div></div></code></div><=
br><div>Moreover, comparing to `in_place_arg_t`, I think `integral_constant=
` is inappropriately named, and there seem to be little necessity to define=
 any member types or constants in it, because these metadata is already pas=
sed by templates. This design is also considered as a solution to another t=
hread &quot;<a href=3D"https://groups.google.com/a/isocpp.org/forum/#!topic=
/std-proposals/LANKIrTpaD4">Constexpr function parameters through special c=
onversions</a>&quot; started by Nicol Bolas.</div><div><br></div><div>The m=
otivation of this design comes from the implementation of another unpublish=
ed proposal of mine about polymorphism (I am still working on it), and I fo=
und it useful when recursively calling constexpr functions in non-constexpr=
 ones with custom input.</div><div><br></div><div>I am looking forward to y=
our comments and suggestions!</div><div><br></div><div>Mingxin Wang</div></=
div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/527c448b-b8dd-4877-b63f-b399c167da4d%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/527c448b-b8dd-4877-b63f-b399c167da4d=
%40isocpp.org</a>.<br />

------=_Part_5112_1429278779.1507514881268--

------=_Part_5111_544801364.1507514881268--

.
