cheind / kdmap

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

VectorOperations should use 'ref' #4

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
As a struct might implement the IVector interface it is necessary to flag all 
by reference parameters with the ref keyword. See 
Accelerators.VectorOperations for example.

Original issue reported on code.google.com by christop...@gmail.com on 21 Jun 2009 at 6:04

GoogleCodeExporter commented 9 years ago
siwtched milestone number

Original comment by christop...@gmail.com on 21 Jun 2009 at 1:05

GoogleCodeExporter commented 9 years ago
Adding an issue-test to verify issue.
Currently, if a struct is used that encapsulates the coordinates as a reference 
type 
(i.e as an System.Array or Collection type) then everything works as expected. 
The 
struct is copied by value, but coordinates are copied by reference. 

On the other side, when value types are explicitely used to store the 
coordinates 
VectorOperations methods fail.

Original comment by christop...@gmail.com on 22 Jun 2009 at 6:05

GoogleCodeExporter commented 9 years ago
modified signatures of methods modifying IVectors to 

Sub<T>(IVector a, IVector b, ref T dest) where T : IVector {}.

It seems to be inconvinient/impossible to have a signature such as 

Sub(IVector a, IVector b, ref IVector dest)

since the ref argument need to be cast to IVector such as

Sub(a, b, ref (IVector)dest) which is not possible.

resolved in revision #148.

Original comment by christop...@gmail.com on 22 Jun 2009 at 7:01