Topic: Why no UDL templates on strings?


Author: Matthew Woehlke <mwoehlke.floss@gmail.com>
Date: Fri, 30 Nov 2018 14:58:54 -0500
Raw View
(Apologies if this double-posts; I accidentally sent via gmane
originally, and posting that way is still problematic.)

Why can I not define a template UDL:

  // Option 1
  template <typename T, T... data>
  inline Foo operator""_foo() { ... }

  // Option 2
  template <char... data
  inline Foo operator""_foo() { ... }

....on a string?

  "Hello, world!"_foo;
  u"Hello, world!"_foo;

This seems like an asinine restriction, especially as at least GCC
already knows how to invoke the UDL:

  foo.cpp: error: no matching function for call to
  =E2=80=98operator""_foo<char, 'H', 'e', 'l', 'l', 'o', ' ',
                        'w', 'o', 'r', 'l', 'd', '!'>()=E2=80=99

The only reason there is 'no matching function' is because the compiler
was not allowed to accept the UDL definition(s) as illustrated above:

  foo.cpp: error: literal operator template
  =E2=80=98Foo operator""_foo()=E2=80=99 has invalid parameter list.
  Expected non-type template argument pack <char...>

In fact, it's even worse; if I put e.g. a static_assert in the UDL body,
I can see that GCC is even *instantiating* the UDL as expected!

This is a stupid, pointless restriction. I propose we get rid of it.
Thoughts?

--=20
Matthew

--=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.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/1b65b95c-c3a7-9281-6af5-387e86765631%40gmail.com=
..

.


Author: "'Giuseppe D'Angelo' via ISO C++ Standard - Future Proposals" <std-proposals@isocpp.org>
Date: Sat, 1 Dec 2018 00:34:37 +0100
Raw View
This is a cryptographically signed message in MIME format.

--------------ms050400070902030204040308
Content-Type: text/plain; charset="UTF-8"; format=flowed
Content-Language: en-GB

Hi,

Il 30/11/18 20:58, Matthew Woehlke ha scritto:
> This is a stupid, pointless restriction. I propose we get rid of it.
> Thoughts?

Did you have a look at P0424R1 ?

Cheers,
--
Giuseppe D'Angelo | giuseppe.dangelo@kdab.com | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
KDAB - The Qt, C++ and OpenGL Experts

--
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/1a7c4340-9c38-4c3d-63ef-4a8cf75a9f99%40kdab.com.

--------------ms050400070902030204040308
Content-Type: application/pkcs7-signature; name="smime.p7s"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="smime.p7s"
Content-Description: Firma crittografica S/MIME

MIAGCSqGSIb3DQEHAqCAMIACAQExDzANBglghkgBZQMEAgEFADCABgkqhkiG9w0BBwEAAKCC
CyQwggSvMIIDl6ADAgECAhEA4CPLFRKDU4mtYW56VGdrITANBgkqhkiG9w0BAQsFADBvMQsw
CQYDVQQGEwJTRTEUMBIGA1UEChMLQWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFkZFRydXN0IEV4
dGVybmFsIFRUUCBOZXR3b3JrMSIwIAYDVQQDExlBZGRUcnVzdCBFeHRlcm5hbCBDQSBSb290
MB4XDTE0MTIyMjAwMDAwMFoXDTIwMDUzMDEwNDgzOFowgZsxCzAJBgNVBAYTAkdCMRswGQYD
VQQIExJHcmVhdGVyIE1hbmNoZXN0ZXIxEDAOBgNVBAcTB1NhbGZvcmQxGjAYBgNVBAoTEUNP
TU9ETyBDQSBMaW1pdGVkMUEwPwYDVQQDEzhDT01PRE8gU0hBLTI1NiBDbGllbnQgQXV0aGVu
dGljYXRpb24gYW5kIFNlY3VyZSBFbWFpbCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
AQoCggEBAImxDdp6UxlOcFIdvFamBia3uEngludRq/HwWhNJFaO0jBtgvHpRQqd5jKQi3xdh
TpHV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9yZDEaMBgG
A1UEChMRQ09NT0RPIENBIExpbWl0ZWQxQTA/BgNVBAMTOENPTU9ETyBTSEEtMjU2IENsaWVu
dCBBdXRoZW50aWNhdGlvbiBhbmQgU2VjdXJlIEVtYWlsIENBAhBFV52OgCPAMZmqkvaDgfOp
MA0GCSqGSIb3DQEBAQUABIIBACb+yPTw0uN7s4e2G+baI05M3FCDr6lREmcXs1GAolTiJwuN
rkdBg0Sg5l2wJbwoD71OrbUPki4STRupDpOMLxVUc/i6FOc0iqweH/ysfA11YdjZ4HOK+1Ca
ICl5k45L3nyBJZRr3WmnOyZIq0PgTyOo42naO0Vf1hCpia8wPPvpWd7g3Gsc9ycIxOHPmV7L
48/vBH2JPVIQlsl3IgLDsXwlTfujlJTO8vz7H0DGpateTdYGgL0gIHIzEcoO8JM+NUD9cprS
ZrlU0VPOTG6pX2oay4fuPDH5xxwOoY/rvYPk/jD6AWm7Of0IaTi/ISVS6wtgnIzZNomnQoWP
BKpMCHsAAAAAAAA=
--------------ms050400070902030204040308--

.


Author: Matthew Woehlke <mwoehlke.floss@gmail.com>
Date: Tue, 4 Dec 2018 16:15:04 -0500
Raw View
On 30/11/2018 18.34, 'Giuseppe D'Angelo' via ISO C++ Standard - Future
Proposals wrote:
> Il 30/11/18 20:58, Matthew Woehlke ha scritto:
>> This is a stupid, pointless restriction. I propose we get rid of it.
>> Thoughts?
>=20
> Did you have a look at P0424R1 ?

Thanks... I believe I'd seen that previously, but wasn't thinking about
it. However, while it does potentially solve the problem, and arguably
for a larger range of use cases, the syntax I presented:

  template <typename T, T... str>
  Foo operator"" _foo() { ... }

....is *already supported* by GCC and clang=C2=B9. (It's also arguably bette=
r,
in that a) it is more consistent with the existing literal operator
templates, and b) having the string as a parameter pack is potentially
more convenient, e.g. you can do `sizeof...(str)` on it.

I feel like this approach should at least be considered. Unless there is
a strong reason to do otherwise, I think it makes sense to standardize
existing practice.

(=C2=B9 demo: https://godbolt.org/z/4ynlCY)

--=20
Matthew

--=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.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/3c747ed6-9bb9-95df-1d9c-3c5d0336b25d%40gmail.com=
..

.


Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Tue, 4 Dec 2018 23:28:09 +0200
Raw View
On Tue, 4 Dec 2018 at 23:15, Matthew Woehlke <mwoehlke.floss@gmail.com> wro=
te:
> > Did you have a look at P0424R1 ?
>
> Thanks... I believe I'd seen that previously, but wasn't thinking about
> it. However, while it does potentially solve the problem, and arguably
> for a larger range of use cases, the syntax I presented:
>
>   template <typename T, T... str>
>   Foo operator"" _foo() { ... }
>
> ...is *already supported* by GCC and clang=C2=B9. (It's also arguably bet=
ter,
> in that a) it is more consistent with the existing literal operator
> templates, and b) having the string as a parameter pack is potentially
> more convenient, e.g. you can do `sizeof...(str)` on it.
>
> I feel like this approach should at least be considered. Unless there is

It has been considered. P0424 is following Evolution's guidance.

> a strong reason to do otherwise, I think it makes sense to standardize

Sure there is; representing a compile-time string as individual
characters as template
arguments is a hideously inefficient way to get compile-time strings.

--=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.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/CAFk2RUbQNb1ZNWQ%3DSao%2BO_YxLtN00o2o-_aUX8kiS16=
swcYcUw%40mail.gmail.com.

.


Author: inkwizytoryankes@gmail.com
Date: Wed, 5 Dec 2018 12:29:17 -0800 (PST)
Raw View
------=_Part_71_989050615.1544041757618
Content-Type: multipart/alternative;
 boundary="----=_Part_72_684794071.1544041757618"

------=_Part_72_684794071.1544041757618
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable



On Tuesday, December 4, 2018 at 10:28:23 PM UTC+1, Ville Voutilainen wrote:
>
> On Tue, 4 Dec 2018 at 23:15, Matthew Woehlke <mwoehlk...@gmail.com=20
> <javascript:>> wrote:=20
> > > Did you have a look at P0424R1 ?=20
> >=20
> > Thanks... I believe I'd seen that previously, but wasn't thinking about=
=20
> > it. However, while it does potentially solve the problem, and arguably=
=20
> > for a larger range of use cases, the syntax I presented:=20
> >=20
> >   template <typename T, T... str>=20
> >   Foo operator"" _foo() { ... }=20
> >=20
> > ...is *already supported* by GCC and clang=C2=B9. (It's also arguably b=
etter,=20
> > in that a) it is more consistent with the existing literal operator=20
> > templates, and b) having the string as a parameter pack is potentially=
=20
> > more convenient, e.g. you can do `sizeof...(str)` on it.=20
> >=20
> > I feel like this approach should at least be considered. Unless there i=
s=20
>
> It has been considered. P0424 is following Evolution's guidance.=20
>
> > a strong reason to do otherwise, I think it makes sense to standardize=
=20
>
> Sure there is; representing a compile-time string as individual=20
> characters as template=20
> arguments is a hideously inefficient way to get compile-time strings.=20
>
=20
If this solution is so bad why GCC and Clang implemented this?
As starting point of some metaprogam list of chars would be preferred.
If you try throw 1000 char long string this will break but for 10-20 range=
=20
this could work fine.
This is same domain as (and probably will share implementation):
template <char...> double operator "" _x();
Any other pitfalls that could affect it?

--=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.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/d6032e3a-fee2-4f69-9e48-9a9b28a8ee11%40isocpp.or=
g.

------=_Part_72_684794071.1544041757618
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>On Tuesday, December 4, 2018 at 10:28:23 PM UTC+1,=
 Ville Voutilainen wrote:<blockquote class=3D"gmail_quote" style=3D"margin:=
 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">On Tu=
e, 4 Dec 2018 at 23:15, Matthew Woehlke &lt;<a href=3D"javascript:" target=
=3D"_blank" gdf-obfuscated-mailto=3D"uUm_9f2NAAAJ" rel=3D"nofollow" onmouse=
down=3D"this.href=3D&#39;javascript:&#39;;return true;" onclick=3D"this.hre=
f=3D&#39;javascript:&#39;;return true;">mwoehlk...@gmail.com</a>&gt; wrote:
<br>&gt; &gt; Did you have a look at P0424R1 ?
<br>&gt;
<br>&gt; Thanks... I believe I&#39;d seen that previously, but wasn&#39;t t=
hinking about
<br>&gt; it. However, while it does potentially solve the problem, and argu=
ably
<br>&gt; for a larger range of use cases, the syntax I presented:
<br>&gt;
<br>&gt; =C2=A0 template &lt;typename T, T... str&gt;
<br>&gt; =C2=A0 Foo operator&quot;&quot; _foo() { ... }
<br>&gt;
<br>&gt; ...is *already supported* by GCC and clang=C2=B9. (It&#39;s also a=
rguably better,
<br>&gt; in that a) it is more consistent with the existing literal operato=
r
<br>&gt; templates, and b) having the string as a parameter pack is potenti=
ally
<br>&gt; more convenient, e.g. you can do `sizeof...(str)` on it.
<br>&gt;
<br>&gt; I feel like this approach should at least be considered. Unless th=
ere is
<br>
<br>It has been considered. P0424 is following Evolution&#39;s guidance.
<br>
<br>&gt; a strong reason to do otherwise, I think it makes sense to standar=
dize
<br>
<br>Sure there is; representing a compile-time string as individual
<br>characters as template
<br>arguments is a hideously inefficient way to get compile-time strings.
<br></blockquote><div>=C2=A0</div><div>If this solution is so bad why GCC a=
nd Clang implemented this?</div><div> As starting point of some metaprogam =
list of chars would be preferred.</div><div>If you try throw 1000 char long=
 string this will break but for 10-20 range this could work fine.</div><div=
></div><div>This is same domain as (and probably will share implementation)=
:<br></div><div><div style=3D"background-color: rgb(250, 250, 250); border-=
color: rgb(187, 187, 187); border-style: solid; border-width: 1px; overflow=
-wrap: break-word;" class=3D"prettyprint"><code class=3D"prettyprint"><div =
class=3D"subprettyprint"><span style=3D"color: #008;" class=3D"styled-by-pr=
ettify">template</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt=
;</span><span style=3D"color: #008;" class=3D"styled-by-prettify">char</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">...&gt;</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span styl=
e=3D"color: #008;" class=3D"styled-by-prettify">double</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #=
008;" class=3D"styled-by-prettify">operator</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> </span><span style=3D"color: #080;" class=
=3D"styled-by-prettify">&quot;&quot;</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> _x</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">();</span></div></code></div>Any other pitfalls that cou=
ld affect it?<br><br></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/d6032e3a-fee2-4f69-9e48-9a9b28a8ee11%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/d6032e3a-fee2-4f69-9e48-9a9b28a8ee11=
%40isocpp.org</a>.<br />

------=_Part_72_684794071.1544041757618--

------=_Part_71_989050615.1544041757618--

.


Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Wed, 5 Dec 2018 22:37:12 +0200
Raw View
On Wed, 5 Dec 2018 at 22:29, <inkwizytoryankes@gmail.com> wrote:

>> Sure there is; representing a compile-time string as individual
>> characters as template
>> arguments is a hideously inefficient way to get compile-time strings.
>
>
> If this solution is so bad why GCC and Clang implemented this?

There are compilers designed to be embedded as tools that provide an
accurate representation
of a C++ program/source file for tools above them. The overhead they
suffer from representing
a string literal as a bag of individual single-char template arguments
is infeasible.

> As starting point of some metaprogam list of chars would be preferred.
> If you try throw 1000 char long string this will break but for 10-20 range this could work fine.
> This is same domain as (and probably will share implementation):
> template <char...> double operator "" _x();
> Any other pitfalls that could affect it?

We are not in the business of shipping a language where a language
facility breaks down horribly
at a kilobyte limit. Instead of insisting on getting a pack of
characters as a template argument
in order to apply sizeof...(pack) on it, you can just as well do

constexpr std::string real_cpp_code_in_cpp20{My_Arg};
now_use_that_stuff<real_cpp_code_in_cpp20.size()>(whatever);

Would you think that's superior to applying a sizeof... on something
that looks like a pack of chars?
Or otherwise superior to trying to fiddle with raw arrays?

--
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/CAFk2RUa9RE8GEQS3XcPu4U1wxCYmtrgFAbk6H9q%2BQQbF4%2BEFdg%40mail.gmail.com.

.


Author: inkwizytoryankes@gmail.com
Date: Wed, 5 Dec 2018 13:42:39 -0800 (PST)
Raw View
------=_Part_81_1076791584.1544046160057
Content-Type: multipart/alternative;
 boundary="----=_Part_82_984186054.1544046160059"

------=_Part_82_984186054.1544046160059
Content-Type: text/plain; charset="UTF-8"



On Wednesday, December 5, 2018 at 9:37:26 PM UTC+1, Ville Voutilainen wrote:
>
> On Wed, 5 Dec 2018 at 22:29, <inkwizyt...@gmail.com <javascript:>> wrote:
>
> >> Sure there is; representing a compile-time string as individual
> >> characters as template
> >> arguments is a hideously inefficient way to get compile-time strings.
> >
> >
> > If this solution is so bad why GCC and Clang implemented this?
>
> There are compilers designed to be embedded as tools that provide an
> accurate representation
> of a C++ program/source file for tools above them. The overhead they
> suffer from representing
> a string literal as a bag of individual single-char template arguments
> is infeasible.
>
> > As starting point of some metaprogam list of chars would be preferred.
> > If you try throw 1000 char long string this will break but for 10-20
> range this could work fine.
> > This is same domain as (and probably will share implementation):
> > template <char...> double operator "" _x();
> > Any other pitfalls that could affect it?
>
> We are not in the business of shipping a language where a language
> facility breaks down horribly
> at a kilobyte limit. Instead of insisting on getting a pack of
> characters as a template argument
> in order to apply sizeof...(pack) on it, you can just as well do
>
> constexpr std::string real_cpp_code_in_cpp20{My_Arg};
> now_use_that_stuff<real_cpp_code_in_cpp20.size()>(whatever);
>
> Would you think that's superior to applying a sizeof... on something
> that looks like a pack of chars?
> Or otherwise superior to trying to fiddle with raw arrays?
>

In my case use of `sizeof...` is not main part of reason why I want use
this shape of UDL.

I have in mind something like that (compile parser of some syntax in
string):

template<typename>
struct magic_A{};
template<typename, typename>
struct magic_B{};

template<char... A>
struct impl_magic;

template<char... A>
using impl_magic_t = typename impl_magic<A...>::type;

// final case
template<>
struct impl_magic<>
{
    using type = void;
};

// "A" is some kind of warper
template<char... A>
struct impl_magic<'A', A...>
{
  using type = magic_A<impl_magic_t<A...>>;
};

// "BX" seperate next X chars
template<char A1, char... A>
struct impl_magic<'B', '1', A1, A...>
{
  using type = magic_B<impl_magic_t<A1>, impl_magic_t<A...>>;
};
template<char A1, char A2, char... A>
struct impl_magic<'B', '2', A1, A2, A...>
{
  using type = magic_B<impl_magic_t<A1, A2>, impl_magic_t<A...>>;
};
template<char A1, char A2, char A3, char... A>
struct impl_magic<'B', '3', A1, A2, A3, A...>
{
  using type = magic_B<impl_magic_t<A1, A2, A3>, impl_magic_t<A...>>;
};
//etc. for 4,5, ...

template<typename TChar, TChar... A>
impl_magic_t<A...> operator ""_magic() { return {}; }


decltype("B2AAAA"_magic) z = 1;
//error: conversion from 'int' to non-scalar type 'impl_magic_t<'B', '2',
'A', 'A', 'A', 'A'>'
// {aka 'magic_B<magic_A<magic_A<void> >, magic_A<magic_A<void> > >'}
requested


And now is very easy to use `A...` and I can start string transformations,
with other syntax this is possible too but need more boilerplate to make it
work.
(This code work fine in GCC and Clang)

--
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/f7dc2a65-811d-4f24-af87-4d5a06773694%40isocpp.org.

------=_Part_82_984186054.1544046160059
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>On Wednesday, December 5, 2018 at 9:37:26 PM UTC+1=
, Ville Voutilainen wrote:<blockquote class=3D"gmail_quote" style=3D"margin=
: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">On W=
ed, 5 Dec 2018 at 22:29, &lt;<a href=3D"javascript:" target=3D"_blank" gdf-=
obfuscated-mailto=3D"ntt6kcrZAAAJ" rel=3D"nofollow" onmousedown=3D"this.hre=
f=3D&#39;javascript:&#39;;return true;" onclick=3D"this.href=3D&#39;javascr=
ipt:&#39;;return true;">inkwizyt...@gmail.com</a>&gt; wrote:
<br>
<br>&gt;&gt; Sure there is; representing a compile-time string as individua=
l
<br>&gt;&gt; characters as template
<br>&gt;&gt; arguments is a hideously inefficient way to get compile-time s=
trings.
<br>&gt;
<br>&gt;
<br>&gt; If this solution is so bad why GCC and Clang implemented this?
<br>
<br>There are compilers designed to be embedded as tools that provide an
<br>accurate representation
<br>of a C++ program/source file for tools above them. The overhead they
<br>suffer from representing
<br>a string literal as a bag of individual single-char template arguments
<br>is infeasible.
<br>
<br>&gt; As starting point of some metaprogam list of chars would be prefer=
red.
<br>&gt; If you try throw 1000 char long string this will break but for 10-=
20 range this could work fine.
<br>&gt; This is same domain as (and probably will share implementation):
<br>&gt; template &lt;char...&gt; double operator &quot;&quot; _x();
<br>&gt; Any other pitfalls that could affect it?
<br>
<br>We are not in the business of shipping a language where a language
<br>facility breaks down horribly
<br>at a kilobyte limit. Instead of insisting on getting a pack of
<br>characters as a template argument
<br>in order to apply sizeof...(pack) on it, you can just as well do
<br>
<br>constexpr std::string real_cpp_code_in_cpp20{My_Arg}<wbr>;
<br>now_use_that_stuff&lt;real_cpp_<wbr>code_in_cpp20.size()&gt;(<wbr>whate=
ver);
<br>
<br>Would you think that&#39;s superior to applying a sizeof... on somethin=
g
<br>that looks like a pack of chars?
<br>Or otherwise superior to trying to fiddle with raw arrays?
<br></blockquote><div><br></div><div>In my case use of `sizeof...` is not m=
ain part of reason why I want use this shape of UDL.</div><div><br></div><d=
iv>I have in mind something like that (compile parser of some syntax in str=
ing):</div><div><div style=3D"color: #000000;background-color: #fffffe;font=
-family: Consolas, "><div style=3D"color: #000000;background-color: #fffffe=
;font-family: Consolas, "><div style=3D"color: #000000;background-color: #f=
ffffe;font-family: Consolas, "><div style=3D"color: #000000;background-colo=
r: #fffffe;font-family: Consolas, "><br><div style=3D"background-color: rgb=
(250, 250, 250); border-color: rgb(187, 187, 187); border-style: solid; bor=
der-width: 1px; overflow-wrap: break-word;" class=3D"prettyprint"><code cla=
ss=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"color: #008=
;" class=3D"styled-by-prettify">template</span><span style=3D"color: #080;"=
 class=3D"styled-by-prettify">&lt;typename&gt;</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #008;"=
 class=3D"styled-by-prettify">struct</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> magic_A</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">{};</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"><br></span><span style=3D"color: #008;" class=3D"styled-by=
-prettify">template</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">&lt;</span><span style=3D"color: #008;" class=3D"styled-by-prettif=
y">typename</span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span>=
<span style=3D"color: #008;" class=3D"styled-by-prettify">typename</span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">&gt;</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=3D=
"color: #008;" class=3D"styled-by-prettify">struct</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> magic_B</span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">{};</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"><br><br></span><span style=3D"color: #008;" =
class=3D"styled-by-prettify">template</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">&lt;</span><span style=3D"color: #008;" class=3D=
"styled-by-prettify">char</span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">...</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> A</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
&gt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></=
span><span style=3D"color: #008;" class=3D"styled-by-prettify">struct</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> impl_magic</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"><br><br></span><span sty=
le=3D"color: #008;" class=3D"styled-by-prettify">template</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">char</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">...</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"> A</span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">&gt;</span><span style=3D"color: #000;" class=3D"styled=
-by-prettify"><br></span><span style=3D"color: #008;" class=3D"styled-by-pr=
ettify">using</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> impl_magic_t </span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">=3D</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
 </span><span style=3D"color: #008;" class=3D"styled-by-prettify">typename<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> impl_magic=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify">A</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">...&gt;::</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify">type</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"><br><br></span><span style=3D"color: #800=
;" class=3D"styled-by-prettify">// final case</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #008;" =
class=3D"styled-by-prettify">template</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">&lt;&gt;</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"><br></span><span style=3D"color: #008;" class=3D"s=
tyled-by-prettify">struct</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> impl_magic</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">&lt;&gt;</span><span style=3D"color: #000;" class=3D"styled=
-by-prettify"><br></span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><=
br>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"styled-by-pre=
ttify">using</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> type </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
=3D</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span style=3D"color: #008;" class=3D"styled-by-prettify">void</span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">};</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"><br><br></span><span style=3D"color: #800;" c=
lass=3D"styled-by-prettify">// &quot;A&quot; is some kind of warper</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span s=
tyle=3D"color: #008;" class=3D"styled-by-prettify">template</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"=
color: #008;" class=3D"styled-by-prettify">char</span><span style=3D"color:=
 #660;" class=3D"styled-by-prettify">...</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"> A</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">&gt;</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"><br></span><span style=3D"color: #008;" class=3D"styled-b=
y-prettify">struct</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> impl_magic</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">&lt;</span><span style=3D"color: #080;" class=3D"styled-by-prettif=
y">&#39;A&#39;</span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> A</s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">...&gt;</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 </span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">using</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> type </span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> magic_A</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">&lt;</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify">impl_magic_t</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">&lt;</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify">A</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">...&gt;&gt;;</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"><br></span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">};</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><=
br><br></span><span style=3D"color: #800;" class=3D"styled-by-prettify">// =
&quot;BX&quot; seperate next X chars</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"><br></span><span style=3D"color: #008;" class=3D"=
styled-by-prettify">template</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">&lt;</span><span style=3D"color: #008;" class=3D"styled-b=
y-prettify">char</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> A1</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><s=
pan style=3D"color: #008;" class=3D"styled-by-prettify">char</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">...</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"> A</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">&gt;</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"><br></span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">struct</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> impl_magic</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">&lt;</span><span style=3D"color: #080;" class=3D"style=
d-by-prettify">&#39;B&#39;</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> </span><span style=3D"color: #080;" class=3D"styled-by-prettify">&#=
39;1&#39;</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> A1</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> A</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">...&gt;</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br>=C2=A0 </span><span style=3D"color: #008;" clas=
s=3D"styled-by-prettify">using</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> type </span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">=3D</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> magic_B</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">&lt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
>impl_magic_t</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">&lt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify">A1<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;,</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> impl_magic_t</s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify">A</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">...&gt;&gt;;</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">};</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #008;" =
class=3D"styled-by-prettify">template</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">&lt;</span><span style=3D"color: #008;" class=3D=
"styled-by-prettify">char</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> A1</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
</span><span style=3D"color: #008;" class=3D"styled-by-prettify">char</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> A2</span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #0=
08;" class=3D"styled-by-prettify">char</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">...</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> A</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">&gt;</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"><br></span><span style=3D"color: #008;" class=3D"styled-by-prettify"=
>struct</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> im=
pl_magic</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&l=
t;</span><span style=3D"color: #080;" class=3D"styled-by-prettify">&#39;B&#=
39;</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span st=
yle=3D"color: #080;" class=3D"styled-by-prettify">&#39;2&#39;</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> A1</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> A2</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> A</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">...&gt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><=
br></span><span style=3D"color: #660;" class=3D"styled-by-prettify">{</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 </spa=
n><span style=3D"color: #008;" class=3D"styled-by-prettify">using</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> type </span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> magic_B</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify">impl_magic_t</span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify">A1</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> A2</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">&gt;,</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> impl_magic_t</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">&lt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
A</span><span style=3D"color: #660;" class=3D"styled-by-prettify">...&gt;&g=
t;;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">};</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span styl=
e=3D"color: #008;" class=3D"styled-by-prettify">template</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">char</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> A1</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-=
prettify">char</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> A2</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><spa=
n style=3D"color: #008;" class=3D"styled-by-prettify">char</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> A3</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">char</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">...</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"> A</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">&gt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br=
></span><span style=3D"color: #008;" class=3D"styled-by-prettify">struct</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> impl_magic</=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><=
span style=3D"color: #080;" class=3D"styled-by-prettify">&#39;B&#39;</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"col=
or: #080;" class=3D"styled-by-prettify">&#39;3&#39;</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"> A1</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> A2</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
 A3</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> A</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">...&gt;</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">{</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"><br>=C2=A0 </span><span style=3D"color: #0=
08;" class=3D"styled-by-prettify">using</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> type </span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> magic_B</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">&lt;</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify">impl_magic_t</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">&lt;</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify">A1</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> A2</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> A3</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">&gt;,</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> impl_magic_t</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify">A</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">...&gt;&gt;;</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">};</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"><br></span><span style=3D"color: #800;" class=3D"styled-by-pret=
tify">//etc. for 4,5, ...</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"><br><br></span><span style=3D"color: #008;" class=3D"styled-=
by-prettify">template</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">&lt;</span><span style=3D"color: #008;" class=3D"styled-by-prett=
ify">typename</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> </span><span style=3D"color: #606;" class=3D"styled-by-prettify">TChar<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #606;" class=3D"styled-by-prettify">TChar</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">...</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> A</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">&gt;</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"><br>impl_magic_t</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">&lt;</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify">A</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">...&gt;</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">=
operator</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> <=
/span><span style=3D"color: #080;" class=3D"styled-by-prettify">&quot;&quot=
;</span><span style=3D"color: #000;" class=3D"styled-by-prettify">_magic</s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">()</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" =
class=3D"styled-by-prettify">return</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">{};</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
}</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><br><=
br></span><span style=3D"color: #008;" class=3D"styled-by-prettify">decltyp=
e</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><=
span style=3D"color: #080;" class=3D"styled-by-prettify">&quot;B2AAAA&quot;=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify">_magic</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">)</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"> z </span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #066;=
" class=3D"styled-by-prettify">1</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"><br></span><span style=3D"color: #800;" class=3D"styled-by-p=
rettify">//error: conversion from &#39;int&#39; to non-scalar type &#39;imp=
l_magic_t&lt;&#39;B&#39;, &#39;2&#39;, &#39;A&#39;, &#39;A&#39;, &#39;A&#39=
;, &#39;A&#39;&gt;&#39;</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"><br></span><span style=3D"color: #800;" class=3D"styled-by-pre=
ttify">// {aka &#39;magic_B&lt;magic_A&lt;magic_A&lt;void&gt; &gt;, magic_A=
&lt;magic_A&lt;void&gt; &gt; &gt;&#39;} requested</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"><br></span></div></code></div></div>=
<div style=3D"color: #000000;background-color: #fffffe;font-family: Consola=
s, "><br></div></div></div></div><br>And now is very easy to use `A...` and=
 I can start string transformations,</div><div> with other syntax this is p=
ossible too but need more boilerplate to make it work.</div><div>(This code=
 work fine in GCC and Clang)<br><br></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/f7dc2a65-811d-4f24-af87-4d5a06773694%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/f7dc2a65-811d-4f24-af87-4d5a06773694=
%40isocpp.org</a>.<br />

------=_Part_82_984186054.1544046160059--

------=_Part_81_1076791584.1544046160057--

.