View source code
Display the source code in object.d from which this page was generated on github.
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 using local clone.

Module object

Forms the symbols available to all D programs. Includes Object, which is the root of the class object hierarchy. This module is implicitly imported.

Functions

NameDescription
assumeSafeAppend(arr) Assume that it is safe to append to this array. Appends made to this array after calling this function may append in place, even if the array was a slice of a larger array to begin with.
byKey(aa) Returns a forward range over the keys of the associative array.
byKeyValue(aa) Returns a forward range over the key value pairs of the associative array.
byValue(aa) Returns a forward range over the values of the associative array.
capacity(arr) (Property) Gets the current capacity of a slice. The capacity is the size that the slice can grow to before the underlying array must be reallocated or extended.
clear(aa) Removes all remaining keys and values from an associative array.
destroy(obj) Destroys the given object and optionally resets to initial state. It's used to destroy an object, calling its destructor or finalizer so it no longer references any other objects. It does not initiate a GC cycle or free any GC memory. If initialize is supplied false, the object is considered invalid after destruction, and should not be referenced.
dup(aa) Create a new associative array of the same size and copy the contents of the associative array into it.
dup(a) Provide the .dup array property.
get(aa, key, defaultValue) Looks up key; if it exists returns corresponding value else evaluates and returns defaultValue.
hashOf(arg, seed) Calculates the hash value of arg with an optional seed initial value. The result might not be equal to typeid(T).getHash(&arg).
hashOf(arg, seed) Calculates the hash value of arg with an optional seed initial value. The result might not be equal to typeid(T).getHash(&arg).
idup(a) Provide the .idup array property.
keys(aa) Returns a dynamic array, the elements of which are the keys in the associative array.
opEquals(lhs, rhs) Returns true if lhs and rhs are equal.
rehash(aa) Reorganizes the associative array in place so that lookups are more efficient.
require(aa, key, value) Looks up key; if it exists returns corresponding value else evaluates value, adds it to the associative array and returns it.
reserve(arr, newcapacity) Reserves capacity for a slice. The capacity is the size that the slice can grow to before the underlying array must be reallocated or extended.
update(aa, key, create, update) Looks up key; if it exists applies the update delegate else evaluates the create delegate and adds it to the associative array
values(aa) Returns a dynamic array, the elements of which are the values in the associative array.

Classes

NameDescription
Error The base class of all unrecoverable runtime errors.
Exception The base class of all errors that are safe to catch and handle.
Object All D class objects inherit from Object.
Throwable The base class of all thrown objects.
TypeInfo Runtime type information about a type. Can be retrieved for any type using a TypeidExpression.
TypeInfo_Class Runtime type information about a class. Can be retrieved from an object instance by using the .classinfo property.

Structs

NameDescription
Interface Information about an interface. When an object is accessed via an interface, an Interface* appears as the first entry in its vtbl.
ModuleInfo An instance of ModuleInfo is generated into the object file for each compiled module.
OffsetTypeInfo Array of pairs giving the offset and type information for each member in an aggregate.

Manifest constants

NameTypeDescription
rtinfoNoPointers shortcuts for the precise GC, also generated by the compiler used instead of the actual pointer bitmap

Global variables

NameTypeDescription
RTInfoImpl size_t[pointerBitmap.length] Create RTInfo for type T

Authors

Walter Bright, Sean Kelly

License

Boost License 1.0.