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.

Reply via email to