24 lines
521 B
Zig
24 lines
521 B
Zig
const slices = @import("./slices.zig");
|
|
|
|
const std = @import("std");
|
|
|
|
pub fn Parallel(comptime Value: type) type {
|
|
const Slices = slices.Parallel(Value);
|
|
const alignment = @alignOf(Value);
|
|
|
|
return struct {
|
|
allocator: std.mem.Allocator,
|
|
slices: slices.Parallel(Value) = .{},
|
|
|
|
const Self = @This();
|
|
|
|
pub fn len(self: Self) usize {
|
|
return self.slices.len;
|
|
}
|
|
|
|
pub fn values(self: *Self, comptime field: Slices.Field) []align (alignment) Slices.Element(field) {
|
|
return self.slices.slice(field);
|
|
}
|
|
};
|
|
}
|