zengqh / slimdx

Automatically exported from code.google.com/p/slimdx
0 stars 0 forks source link

Indexers for matrix/vector/etc #356

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The ability to programmatically reference structure elements is 
occasionally quite useful. Our current implementation of matrix/vector 
prevents this. The obvious solution of making the elements an array won't 
work, because it will then be impossible to default-construct a matrix or 
vector (since the array will default-construct to null and be un-settable, 
and the various ways to make that work are just ugly).

However, we could take advantage of the fact that our structures enforce 
sequential layout, and provide an indexer that uses pin_ptrs to pin the 
first element and then do the appropriate offsetting to get to the element 
in question, and return or set it.

I don't believe the pinning will cause a bothersome performance impact. 
I'm going to evaluate this concept to see how well it works in practice.

Original issue reported on code.google.com by josh.petrie on 25 Oct 2008 at 6:08

GoogleCodeExporter commented 9 years ago
I've checked in a sample implementation in 755, along with tests verifying that 
it 
works.

Original comment by josh.petrie on 25 Oct 2008 at 7:19

GoogleCodeExporter commented 9 years ago
Is this done?

Original comment by Mike.Popoloski on 5 Nov 2008 at 5:31

GoogleCodeExporter commented 9 years ago
Not quite yet. I think there are one or two classes still lacking indexers that
should have them.

Original comment by josh.petrie on 6 Nov 2008 at 4:48

GoogleCodeExporter commented 9 years ago

Original comment by josh.petrie on 12 Nov 2008 at 2:14