expression templates

so so at so.so
Tue Mar 29 15:14:31 PDT 2011


On Tue, 29 Mar 2011 22:56:10 +0300, dsimcha <dsimcha at yahoo.com> wrote:

Occasionally i encounter this argument that operator overloading is bad  
thing when it is abused.
I don't overload operators offensively myself, i use dot(vec, vec)  
cross(vec, vec) for example because there is not a suitable operator and  
these names suits much better.

On the other hand i am not against languages being flexible, quite  
contrary i don't call it a language if it is not.
OO is an impressive tool and we need tools like this for better libraries.  
You can't change a language for a long time but you can update a library  
in very short period of time.

vec add(a, b) { return a.x - b.x }
vec operator+(a, b) { return a.x - b.x }

Is there a difference?


More information about the Digitalmars-d mailing list