Low dimensional matrices, vectors, quaternions and a cubic equation solver

Lars T. Kyllingstad public at kyllingen.NOSPAMnet
Mon Apr 19 13:42:13 PDT 2010


Eric Poggel wrote:
> On 4/19/2010 6:43 AM, Lars T. Kyllingstad wrote:
>> IMO, general vectors/matrices should be structs wrapping a pointer to
>> the data:
>>
>>    struct Vector(T)
>>    {
>>       T* ptr;
>>       size_t length;
>>       size_t stride;
>>    }
>>
>> Low-dimensional fixed-size vectors should probably be value types.
> 
> I think it would be confusing to have some vectors as value and others 
> as reference types, unless they were different types in the library itself.

That was the idea, to have *both* a generic Vector(T) type and 
specialised Vector2D(T) and Vector3D(T) types.

-Lars



More information about the Digitalmars-d mailing list