Skip to content

Commit 4e95a3b

Browse files
committed
Add struct constraint to generic type parameter
1 parent defe8b8 commit 4e95a3b

4 files changed

Lines changed: 5 additions & 5 deletions

File tree

src/GraphBLAS-sharp/CSRMatrix.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ with
1919
ColumnCount = 0
2020
}
2121

22-
type CSRMatrix<'a>(csrTuples: CSRFormat<'a>) =
22+
type CSRMatrix<'a when 'a : struct>(csrTuples: CSRFormat<'a>) =
2323
inherit Matrix<'a>()
2424

2525
let rowCount = csrTuples.RowPointers.Length - 1

src/GraphBLAS-sharp/DenseVector.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
namespace GraphBLAS.FSharp
22

3-
type DenseVector<'a>(vector: 'a[]) =
3+
type DenseVector<'a when 'a : struct>(vector: 'a[]) =
44
inherit Vector<'a>()
55

66
new() = DenseVector(Array.zeroCreate<'a> 0)

src/GraphBLAS-sharp/MatrixAndVector.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
namespace GraphBLAS.FSharp
22

33
[<AbstractClass>]
4-
type Matrix<'a>() =
4+
type Matrix<'a when 'a : struct>() =
55
abstract RowCount: int
66
abstract ColumnCount: int
77
abstract Mask: Mask2D
@@ -34,7 +34,7 @@ type Matrix<'a>() =
3434
static member inline (.+) (x: Matrix<'a>, y: Matrix<'a>) = x.EWiseAddInplace y
3535
static member inline (.*) (x: Matrix<'a>, y: Matrix<'a>) = x.EWiseMultInplace y
3636

37-
and [<AbstractClass>] Vector<'a>() =
37+
and [<AbstractClass>] Vector<'a when 'a : struct>() =
3838
abstract Length: int
3939
abstract Mask: Mask1D
4040
abstract AsArray: 'a[]

src/GraphBLAS-sharp/Scalar.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
namespace GraphBLAS.FSharp
22

3-
type Scalar<'a> = Scalar of 'a
3+
type Scalar<'a when 'a : struct> = Scalar of 'a
44
with
55
static member op_Implicit (Scalar source) = source

0 commit comments

Comments
 (0)