[Issue 3988] New: Provide canonical example for operator overloading
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Mar 19 23:19:46 PDT 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3988
Summary: Provide canonical example for operator overloading
Product: D
Version: 2.041
Platform: All
URL: http://digitalmars.com/d/2.0/operatoroverloading.html
OS/Version: All
Status: NEW
Keywords: spec
Severity: normal
Priority: P1
Component: www.digitalmars.com
AssignedTo: nobody at puremagic.com
ReportedBy: jlquinn at optonline.net
--- Comment #0 from Jerry Quinn <jlquinn at optonline.net> 2010-03-19 23:19:43 PDT ---
At first glance, the new operator overloading syntax looks cumbersome by
comparison to C++. Adding the following example to the D docs would make it
clear what the advantage of the new syntax is, as well as not requiring people
to reinvent it repeatedly:
http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=101636
2. Use one mixin expression:
T opBinary(string op)(T rhs) {
return mixin("data "~op~" rhs.data");
}
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list