Arrays
Patrick
spam at spam.at
Fri Mar 16 13:44:48 PDT 2007
A struct which only contains one array of floats:
struct Vector {
float[3] containingElements;
}
I may be too finicky but it really seems like codebloat to me. But if there arent any other solutions...
Frits van Bommel Wrote:
> Patrick wrote:
> > I have a list of vectors and I want to be able to add a vector through a function like this:
> >
> > float[3] giveVector();
> > -----
> > float[][3] vectorList;
> > vectorList ~= giveVector();
> > -----
> >
> > Any ideas on how to implement this? It doesnt really feel right to wrap the vector up in a class or struct...
>
> Why would wrapping it in a simple struct not "feel right"? That's how
> vectors are typically implemented in D, judging by posts in these
> newsgroups.
> (Hint: you may want to search these groups to see how others have
> implemented vectors & matrices to avoid reinventing the wheel for the
> Nth time)
More information about the Digitalmars-d-learn
mailing list