* Re: Re: [C++14] Admit C++ keywords as literal suffixes.
@ 2013-06-18 13:53 3dw4rd
0 siblings, 0 replies; only message in thread
From: 3dw4rd @ 2013-06-18 13:53 UTC (permalink / raw)
To: jwakely.gcc, 3dw4rd; +Cc: gcc, jason, gdr
On 06/18/13, Jonathan Wakely<jwakely.gcc@gmail.com> wrote:
On 18 June 2013 07:04, Ed Smith-Rowland wrote:
> I understand that the literal operators for complex numbers for C++14
> faltered at least in part because of the perceived ugliness of the float
> operator:
>
> constexpr complex<float>
> operator"" i_f(); // fugly
>
> The obvious choice
> constexpr complex<float>
> operator"" if();
>
> failed because 'if' is a keyword. The 'if' keyword can never be exposed in
> this context either by usage in a literal or by explicit call.
>
> Allowing keywords as literal operator suffixes turns out to be a 6-liner if
> gcc. I actually think *disallowing* them is a bit of a bug. (Not sure if
> it was me or the standard).
The standard disallowed them, but that was changed by DR 1473 so you
can define operator ""if now (with no whitespace between the
string-literal and suffix, IIUC)
See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3675.html#1473
IMHO you should implement exactly that resolution, not just a kluge to
allow keywords.
I did not see this DR and that it passed. I just heard "something was in the works". This resolution seems eminently sensible. I withdraw my kludge and will work on DR 1473 implementation.
Thanks,
Ed
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2013-06-18 13:53 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-18 13:53 Re: [C++14] Admit C++ keywords as literal suffixes 3dw4rd
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).