authorgravatar for andreas@proxel.seAndreas Karlsson <andreas@proxel.se> 2021-01-06 15:44:47+01:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-01-06 15:53:53-08:00
log50af87a9e32e39a948d1dffdc4041d88db3f5313
treea073482fd9baf6d12a13de3f20af1df696fe62fb
parentbe6ac82ee1dc6619576da6dc7ba04213faea998d

Fix example code in comments for asc and desc


1 files changed, 2 insertions(+), 2 deletions(-)

lib/std/sort.zig+2-2
...@@ -1129,7 +1129,7 @@ fn swap(...@@ -1129,7 +1129,7 @@ fn swap(
1129 }1129 }
1130}1130}
11311131
1132/// Use to generate a comparator function for a given type. e.g. `sort(u8, slice, asc(u8))`.1132/// Use to generate a comparator function for a given type. e.g. `sort(u8, slice, {}, comptime asc(u8))`.
1133pub fn asc(comptime T: type) fn (void, T, T) bool {1133pub fn asc(comptime T: type) fn (void, T, T) bool {
1134 const impl = struct {1134 const impl = struct {
1135 fn inner(context: void, a: T, b: T) bool {1135 fn inner(context: void, a: T, b: T) bool {
...@@ -1140,7 +1140,7 @@ pub fn asc(comptime T: type) fn (void, T, T) bool {...@@ -1140,7 +1140,7 @@ pub fn asc(comptime T: type) fn (void, T, T) bool {
1140 return impl.inner;1140 return impl.inner;
1141}1141}
11421142
1143/// Use to generate a comparator function for a given type. e.g. `sort(u8, slice, asc(u8))`.1143/// Use to generate a comparator function for a given type. e.g. `sort(u8, slice, {}, comptime desc(u8))`.
1144pub fn desc(comptime T: type) fn (void, T, T) bool {1144pub fn desc(comptime T: type) fn (void, T, T) bool {
1145 const impl = struct {1145 const impl = struct {
1146 fn inner(context: void, a: T, b: T) bool {1146 fn inner(context: void, a: T, b: T) bool {