| ... | ... | @@ -747,13 +747,7 @@ pub fn EnumArray(comptime E: type, comptime V: type) type { |
| 747 | 747 | return IndexedArray(EnumIndexer(E), V, mixin.EnumArrayExt); |
| 748 | 748 | } |
| 749 | 749 | |
| 750 | | /// Pass this function as the Ext parameter to Indexed* if you |
| 751 | | /// do not want to attach any extensions. This parameter was |
| 752 | | /// originally an optional, but optional generic functions |
| 753 | | /// seem to be broken at the moment. |
| 754 | | /// TODO: Once #8169 is fixed, consider switching this param |
| 755 | | /// back to an optional. |
| 756 | | pub fn NoExtension(comptime Self: type) type { |
| 750 | fn NoExtension(comptime Self: type) type { |
| 757 | 751 | _ = Self; |
| 758 | 752 | return NoExt; |
| 759 | 753 | } |
| ... | ... | @@ -762,12 +756,12 @@ const NoExt = struct {}; |
| 762 | 756 | /// A set type with an Indexer mapping from keys to indices. |
| 763 | 757 | /// Presence or absence is stored as a dense bitfield. This |
| 764 | 758 | /// type does no allocation and can be copied by value. |
| 765 | | pub fn IndexedSet(comptime I: type, comptime Ext: fn (type) type) type { |
| 759 | pub fn IndexedSet(comptime I: type, comptime Ext: ?fn (type) type) type { |
| 766 | 760 | comptime ensureIndexer(I); |
| 767 | 761 | return struct { |
| 768 | 762 | const Self = @This(); |
| 769 | 763 | |
| 770 | | pub usingnamespace Ext(Self); |
| 764 | pub usingnamespace (Ext orelse NoExtension)(Self); |
| 771 | 765 | |
| 772 | 766 | /// The indexing rules for converting between keys and indices. |
| 773 | 767 | pub const Indexer = I; |
| ... | ... | @@ -1007,12 +1001,12 @@ test "std.enums.EnumSet const iterator" { |
| 1007 | 1001 | /// A map from keys to values, using an index lookup. Uses a |
| 1008 | 1002 | /// bitfield to track presence and a dense array of values. |
| 1009 | 1003 | /// This type does no allocation and can be copied by value. |
| 1010 | | pub fn IndexedMap(comptime I: type, comptime V: type, comptime Ext: fn (type) type) type { |
| 1004 | pub fn IndexedMap(comptime I: type, comptime V: type, comptime Ext: ?fn (type) type) type { |
| 1011 | 1005 | comptime ensureIndexer(I); |
| 1012 | 1006 | return struct { |
| 1013 | 1007 | const Self = @This(); |
| 1014 | 1008 | |
| 1015 | | pub usingnamespace Ext(Self); |
| 1009 | pub usingnamespace (Ext orelse NoExtension)(Self); |
| 1016 | 1010 | |
| 1017 | 1011 | /// The index mapping for this map |
| 1018 | 1012 | pub const Indexer = I; |
| ... | ... | @@ -1167,12 +1161,12 @@ pub fn IndexedMap(comptime I: type, comptime V: type, comptime Ext: fn (type) ty |
| 1167 | 1161 | |
| 1168 | 1162 | /// A dense array of values, using an indexed lookup. |
| 1169 | 1163 | /// This type does no allocation and can be copied by value. |
| 1170 | | pub fn IndexedArray(comptime I: type, comptime V: type, comptime Ext: fn (type) type) type { |
| 1164 | pub fn IndexedArray(comptime I: type, comptime V: type, comptime Ext: ?fn (type) type) type { |
| 1171 | 1165 | comptime ensureIndexer(I); |
| 1172 | 1166 | return struct { |
| 1173 | 1167 | const Self = @This(); |
| 1174 | 1168 | |
| 1175 | | pub usingnamespace Ext(Self); |
| 1169 | pub usingnamespace (Ext orelse NoExtension)(Self); |
| 1176 | 1170 | |
| 1177 | 1171 | /// The index mapping for this map |
| 1178 | 1172 | pub const Indexer = I; |