F#: Casting to generic type
问题 I'm fairly new to F# and coming from a C++ background. I am trying to write a simple vector class which can be of generic type (int, float, etc) but I run into trouble with the default constructor. I want to initialize the values to be zero but to do this I need to somehow cast a concrete zero to a generic type but I'm not sure how to do this. Perhaps some code might help. Here's what I have so far: type Vector3D<'T> (x :'T, y: 'T, z: 'T) = member this.x = x member this.y = y member this.z =