]> Cypherpunks repositories - gostls13.git/commitdiff
builtin: add documentation for min/max
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Fri, 26 May 2023 04:12:12 +0000 (11:12 +0700)
committerGopher Robot <gobot@golang.org>
Sun, 4 Jun 2023 15:12:46 +0000 (15:12 +0000)
Updates #59488

Change-Id: If873b81fb7f0e28b84a3e5c2ff89426b3e289d5d
Reviewed-on: https://go-review.googlesource.com/c/go/+/498495
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>

src/builtin/builtin.go

index bcfb7ce956320e9f514ba3797a5e267d54faff56..03e90c8a560314eff1065a36d5aff1fb929bbe4a 100644 (file)
@@ -10,6 +10,8 @@ for the language's special identifiers.
 */
 package builtin
 
+import "cmp"
+
 // bool is the set of boolean values, true and false.
 type bool bool
 
@@ -206,6 +208,14 @@ func cap(v Type) int
 //     unbuffered.
 func make(t Type, size ...IntegerType) Type
 
+// The max built-in function returns the largest value of a fixed number of
+// arguments of [cmp.Ordered] types. There must be at least one argument.
+func max[T cmp.Ordered](x T, y ...T) T
+
+// The min built-in function returns the smallest value of a fixed number of
+// arguments of [cmp.Ordered] types. There must be at least one argument.
+func min[T cmp.Ordered](x T, y ...T) T
+
 // The new built-in function allocates memory. The first argument is a type,
 // not a value, and the value returned is a pointer to a newly
 // allocated zero value of that type.