commit 50af87a9e32e39a948d1dffdc4041d88db3f5313 (tree)
parent be6ac82ee1dc6619576da6dc7ba04213faea998d
Author: Andreas Karlsson <andreas@proxel.se>
Date: Wed, 6 Jan 2021 15:44:47 +0100
Fix example code in comments for asc and desc
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/std/sort.zig b/lib/std/sort.zig
@@ -1129,7 +1129,7 @@ fn swap(
}
}
-/// Use to generate a comparator function for a given type. e.g. `sort(u8, slice, asc(u8))`.
+/// Use to generate a comparator function for a given type. e.g. `sort(u8, slice, {}, comptime asc(u8))`.
pub fn asc(comptime T: type) fn (void, T, T) bool {
const impl = struct {
fn inner(context: void, a: T, b: T) bool {
@@ -1140,7 +1140,7 @@ pub fn asc(comptime T: type) fn (void, T, T) bool {
return impl.inner;
}
-/// Use to generate a comparator function for a given type. e.g. `sort(u8, slice, asc(u8))`.
+/// Use to generate a comparator function for a given type. e.g. `sort(u8, slice, {}, comptime desc(u8))`.
pub fn desc(comptime T: type) fn (void, T, T) bool {
const impl = struct {
fn inner(context: void, a: T, b: T) bool {