Extra Array Operator Overloading Request
Frits van Bommel
fvbommel at REMwOVExCAPSs.nl
Wed May 30 11:03:03 PDT 2007
Johan Granberg wrote:
> Jonathan Crapuchettes wrote:
>
>> I do a lot of matrix calculations with a D library that I have written and
>> it would be really nice to be able to overload a few more array operators,
>> like assigned multiplication (i.e. mat1[i,j] += mat2[i,j];). Has this
>> feature been approved, discussed, or planned? Thanks, JC
>
> What is preventing you from doing so now? if opIndex returns a type that
> overloads opAddAssign your example should be possible right now.
Typically, if you have a matrix of T you'd want to have mat[i,j] (or
mat[i][j]) return either a T or something that implicitly converts to
one. Since you can only overload operators on aggregates (class, struct,
union) but can't define implicit conversions for them...
More information about the Digitalmars-d
mailing list