Movatterモバイル変換


[0]ホーム

URL:


D Logo
Menu
Search

Library Reference

version 2.112.0

overview

Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.Requires a signed-in GitHub account. This works well for small changes.If you'd like to make larger changes you may want to consider usinga local clone.

core.internal.array.utils

This module contains utility functions to help the implementation of the runtime hook
License:
Distributed under theBoost Software License 1.0. (See accompanying file LICENSE)

Sourcecore/internal/array/utils.d

enum autoisNoThrow(alias F);
Check if the functionF is calleable in anothrow scope.
Parameters:
FFunction that does not take any parameters
Returns:
if the function is callable in anothrow scope.
templateisPostblitNoThrow(T)
Check if the typeT's postblit is called in nothrow, if it exist
Parameters:
TType to check
Returns:
if the postblit is callable in anothrow scope, if it exist. if it does not exist, return true.
@trusted void[]__arrayAlloc(T)(size_tarrSize);
Allocate a memory block with appendable capabilities for array usage.
Parameters:
size_tarrSizesize of the allocated array in bytes
Returns:
void[] matching requested size on success,null on failure.
pure nothrow size_tnewCapacity(size_tnewlength, size_telemsize);
Given an array of lengthsize that needs to be expanded tonewlength,compute a new capacity.
Better version by Dave Fladebo, enhanced by Steven Schveighoffer:This uses an inverse logorithmic algorithm to pre-allocate a bit morespace for larger arrays.
  • The maximum "extra" space is about 80% of the requested space. This is for
PAGE size and smaller.
  • As the arrays grow, the relative pre-allocated space shrinks.
  • Perhaps most importantly, overall memory usage and stress on the GC
is decreased significantly for demanding environments.
  • The algorithm is tuned to avoid any division at runtime.
Parameters:
size_tnewlengthnew.length
size_telemsizesize of the element in the new array
Returns:
new capacity for array
Copyright © 1999-2026 by theD Language Foundation | Page generated byDdoc on Sat Feb 21 04:06:19 2026

[8]ページ先頭

©2009-2026 Movatter.jp