ironpython2
ironpython2 copied to clipboard
It seems that new features in C# cause the Genetic index can't be used
In opencvsharp:
public ref T At<T>(params int[] idx) where T : unmanaged;
In my program:
confidence = detectionMat.At[float]((i, 2))
Got an error:
System.ArgumentException: The type 'System.Double&' may not be used as a type argument.
It seems that new features in C#: A reference return value is defined by using the ref keyword cause the Genetic index can't be used.
There are likely a number of changes that would need to be made to the DLR (and IronPython) to support this. I tried the following change to CallInstruction.Create
if (info.ReturnType.IsByRef) {
return new MethodInfoCallInstruction(info, argumentCount);
}
but it then fails with:
ByRef return value not supported in reflection invocation
Maybe you could try to define a C# extension method which avoids the ref return? I'm not sure...
public void GetAt<T>(int[] idx, ref T value) => value = At(idx);