github.com/isyscore/isc-gobase@v1.5.3-0.20231218061332-cbc7451899e9/isc/pair.go (about)

     1  package isc
     2  
     3  type Pair[A any, B any] struct {
     4  	First  A
     5  	Second B
     6  }
     7  
     8  type Triple[A any, B any, C any] struct {
     9  	First  A
    10  	Second B
    11  	Third  C
    12  }
    13  
    14  func NewPair[A any, B any](a A, b B) Pair[A, B] {
    15  	return Pair[A, B]{
    16  		First:  a,
    17  		Second: b,
    18  	}
    19  }
    20  
    21  func NewTriple[A any, B any, C any](a A, b B, c C) Triple[A, B, C] {
    22  	return Triple[A, B, C]{
    23  		First:  a,
    24  		Second: b,
    25  		Third:  c,
    26  	}
    27  }