Jarrett Billingsley wrote: > You're suggesting adding something like 25 operator overloads to every > property. Can you say "code bloat"?
It may not be necessary in simple situations where the compiler can figure out that it may use a more direct way. But I believe it is the right way to go if you want more speed out of your properties, yes. > Why not just use the following solution, which has been proposed > God-knows-how-many-times and already has precedence in other languages > (like C#)? > > obj.prop op= value; > > Simply becomes: > > obj.prop.set(obj.prop.get op value); There are several issues with that suggestion: * It works only if (a op= b) always behaves the same as (a = a op b). * It would only work for op= operators. It can't do anything for arbitrary mutator methods on the type of the property. * In most situations, it will still be as slow as my suggested 'slow way', without any extra operator overloads! I will repeat my 'slow' transformation here again: obj.prop op= value; // auto temp = obj.prop.get(); // temp op= value; // obj.prop.set(value); At least with that you don't have those first two issues. -- Michiel Helvensteijn