Small Vectors Proposal

Frits van Bommel fvbommel at REMwOVExCAPSs.nl
Tue Jan 30 10:29:20 PST 2007


Mikola Lysenko wrote:
> All new vector types are pass-by-value, and may be used in combination 
> with any number of other types.  The following expressions would all be 
> valid:
> 
[snip 2 others]
> char[][ucent4] c;

[snip]

> Note that the only two comparison operators allowed on vectors are == 
> and !=.  The problem with <, >, etc. is that there is no commonly agreed 
> upon definition for such things.  Therefore the operators are omitted to 
> avoid confusion.
> 
> int2(1, 2) == int2(1, 2);        //ok, evaluates to true
> float3(1, 0, 0) < float3(0, 0, 1);    // error, < is undefined for vectors

These two sections are contradictory: associative arrays need an 
ordering to be defined on the key type.
How about a simple lexicographical order, with two non-equal vectors (of 
the same dimensionality) comparing as their first non-equal component 
would? (That's how comparisons work for arrays IIRC)


Other than that I don't see any obvious problems with it.



More information about the Digitalmars-d mailing list