mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-03-08 01:24:49 +01:00
std.meta: delete declList
dubious. if people want this logic they should take responsibility for it in their own code.
This commit is contained in:
parent
204fa8959a
commit
3b10383114
1 changed files with 0 additions and 19 deletions
|
|
@ -752,25 +752,6 @@ pub fn fieldIndex(comptime T: type, comptime name: []const u8) ?comptime_int {
|
|||
return null;
|
||||
}
|
||||
|
||||
/// Returns a slice of pointers to public declarations of a namespace.
|
||||
pub fn declList(comptime Namespace: type, comptime Decl: type) []const *const Decl {
|
||||
const S = struct {
|
||||
fn declNameLessThan(context: void, lhs: *const Decl, rhs: *const Decl) bool {
|
||||
_ = context;
|
||||
return mem.lessThan(u8, lhs.name, rhs.name);
|
||||
}
|
||||
};
|
||||
comptime {
|
||||
const decls = declarations(Namespace);
|
||||
var array: [decls.len]*const Decl = undefined;
|
||||
for (decls, 0..) |decl, i| {
|
||||
array[i] = &@field(Namespace, decl.name);
|
||||
}
|
||||
mem.sort(*const Decl, &array, {}, S.declNameLessThan);
|
||||
return &array;
|
||||
}
|
||||
}
|
||||
|
||||
/// Deprecated: use @Int
|
||||
pub fn Int(comptime signedness: std.builtin.Signedness, comptime bit_count: u16) type {
|
||||
return @Int(signedness, bit_count);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue