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 which will iterate over the keys of the associative array. The keys are returned by reference.
byKeyValue(aa) Returns a forward range which will iterate over the key-value pairs of the associative array. The returned pairs are represented by an opaque type with .key and .value properties for accessing references to the key and value of the pair, respectively.
byValue(aa) Returns a forward range which will iterate over the values of the associative array. The values are returned by reference.
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) Creates a new associative array of the same size and copies 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).
idup(a) Provide the .idup array property.
keys(aa) Returns a newly allocated dynamic array containing a copy of the keys from the associative array.
opEquals(lhs, rhs) Implementation for class opEquals override. Calls the class-defined methods after a null check. Please note this is not nogc right now, even if your implementation is, because of the typeinfo name string compare. This is because of dmd's dll implementation. However, it can infer to @safe if your class' opEquals is.
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.
setSameMutex(ownee, owner) Makes ownee use owner's mutex. This will initialize owner's mutex if it hasn't been set yet.
update(aa, key, create, update) Calls create if key doesn't exist in the associative array, otherwise calls update. create returns a corresponding value for key. update accepts a key parameter. If it returns a value, the value is set for key.
values(aa) Returns a newly allocated dynamic array containing a copy of the values from 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 typeid expression.

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.

Templates

NameDescription
imported Provides an "inline import", i.e. an import that is only available for a limited lookup. For example:

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

Aliases

NameTypeDescription
noreturn Nn Bottom type. See noreturn.

Authors

Walter Bright, Sean Kelly

License

Boost License 1.0.