http://d.puremagic.com/issues/show_bug.cgi?id=3481
Witold Baryluk <bary...@smp.if.uj.edu.pl> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bary...@smp.if.uj.edu.pl --- Comment #15 from Witold Baryluk <bary...@smp.if.uj.edu.pl> 2009-12-08 21:35:13 PST --- Just wanted to write: Thanks! I have about 10 classes with already deffinied opPow just waiting to this for years. About Walters question about opPowAssgn, i have few place where i'm for. example squering in place, or (in. for computing exponent of interval matrix), this isn't actually inplace, but makes code more readble, other i example in my libraries i see units library, where i see something like this: Self opPowAssign(int b) { if (b >= 0) { nom = pow(cast(int)nom, b); denom = pow(cast(int)denom, b); } else { auto newnom = pow(cast(int)denom, -b); denom = pow(cast(int)nom, -b); nom = newnom; } return this; } Clearly first can use opPowAssign, of course in such simple example compiler should be detect that x = x ^^ y, for simple types can be done in place. And this opPowAssign is used in few places also. Or clearly like this: Self opPowAssign(int b) { nom ^^= b; denom ^^= b; if (b < 0) { swap(nom, denom); } return this; } I have also few places with something like: new_step = pow(previous_step, f(x)) it can be changed to: step ^^= f(x). and new_step is not nacassarly float or double, it can be slightly more complex structure like interval vector (and exponentation of it can be done in-place). I also think that sometimes pepole will have not enaugh operators, and for the sake of consistency it is good to have opPowAssign. :) Not nacassarly good for clearity of code if it will use ALL opXAssign for very diferent things. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------