Function allocAdvancedWithRetAddr [src]
Prototype
pub inline fn allocAdvancedWithRetAddr( self: Allocator, comptime T: type, comptime alignment: ?u29, n: usize, return_address: usize, ) Error![]align(alignment orelse @alignOf(T)) T
Parameters
self: Allocator
T: type
alignment: ?u29null means naturally aligned
n: usize
return_address: usize
Possible Errors
Source
pub inline fn allocAdvancedWithRetAddr(
self: Allocator,
comptime T: type,
/// null means naturally aligned
comptime alignment: ?u29,
n: usize,
return_address: usize,
) Error![]align(alignment orelse @alignOf(T)) T {
const a = alignment orelse @alignOf(T);
const ptr: [*]align(a) T = @ptrCast(try self.allocWithSizeAndAlignment(@sizeOf(T), a, n, return_address));
return ptr[0..n];
}