[Issue 5040] opOpAssign should be automatically visible for types.

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Mar 28 06:16:32 PDT 2016


https://issues.dlang.org/show_bug.cgi?id=5040

Maksim Zholudev <maximzms at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |maximzms at gmail.com
           Hardware|x86                         |All
                 OS|Windows                     |All
           Severity|normal                      |enhancement

--- Comment #1 from Maksim Zholudev <maximzms at gmail.com> ---
The same can be done with string mixin:
--------------------
T opIndexOpAssign(string op)(T value, int index)
{
    return mixin("contents " ~ op ~ "= value");
}
--------------------

Anyway, the possibility to call operator as function (regardless whether it is
defined explicitly or not) for both built-in and user-defined types could make
this part of D more consistent.

--


More information about the Digitalmars-d-bugs mailing list