Closed GoogleCodeExporter closed 9 years ago
Hmm. Yeah, the problem is that DX uses BOOL, which is actually an int. I'm not
sure
if we should handle that as a special case in SetValue, or add SetBool...
Original comment by promit....@gmail.com
on 10 Sep 2008 at 7:56
Taking ownership.
Original comment by Mike.Popoloski
on 18 Sep 2008 at 7:58
Fixed. (I think).
Original comment by Mike.Popoloski
on 19 Sep 2008 at 3:56
[deleted comment]
I think the array version is still broken. You can't call CopyTo to convert a
bool[]
to an int[]. It will throw an ArrayTypeMismatchException. At least this piece
of code
does:
var d1 = new[] {true, false, true, false};
var d2 = new int[d1.Length];
d1.CopyTo(d2, 0);
You'll probably need to copy the elements by hand.
if( T::typeid == bool::typeid )
{
array<bool>^ oldValues = static_cast<array<bool>^>(values);
array<BOOL>^ newValues = gcnew array<BOOL>( values->Length );
for(int i = 0; i < values->Length; ++i){
newValues[i] = oldValues[i];
}
return SetValue( parameter, newValues );
}
It might be useful to treat bool[] as a special case and provide an overload
for it.
It will avoid the if statement and the cast from T[] to bool[].
Original comment by m...@andreloker.de
on 22 Sep 2008 at 9:12
Grrr...
Original comment by Mike.Popoloski
on 23 Sep 2008 at 3:45
OK, should be fixed now.
Original comment by Mike.Popoloski
on 28 Sep 2008 at 2:17
Original issue reported on code.google.com by
daniel.z...@gmail.com
on 10 Sep 2008 at 12:42