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.

Public Imports

core.internal.hash
public import core.internal.hash : hashOf;

Members

Classes

Error
class Error

The base class of all unrecoverable runtime errors.

Exception
class Exception

The base class of all errors that are safe to catch and handle.

Object
class Object

All D class objects inherit from Object.

Throwable
class Throwable

The base class of all thrown objects.

TypeInfo
class TypeInfo

Runtime type information about a type. Can be retrieved for any type using a $(GLINK2 expression,TypeidExpression, TypeidExpression).

TypeInfo_Class
class TypeInfo_Class

Runtime type information about a class. Can be retrieved from an object instance by using the .classinfo property.

TypeInfo_Function
class TypeInfo_Function

Functions

__ArrayCast
TTo[] __ArrayCast(TFrom[] from)

The compiler lowers expressions of cast(TTo[])TFrom[] to this implementation.

assumeSafeAppend
inout(T[]) assumeSafeAppend(auto ref inout(T[]) 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
auto byKey(T aa)

Returns a forward range over the keys of the associative array.

byKeyValue
auto byKeyValue(T aa)

Returns a forward range over the key value pairs of the associative array.

byValue
auto byValue(T aa)

Returns a forward range over the values of the associative array.

clear
void clear(T aa)

Removes all remaining keys and values from an associative array.

destroy
void destroy(ref T obj)
void destroy(T obj)
void destroy(T obj)
void destroy(ref T obj)
void destroy(ref T 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
V[K] dup(T aa)

Create a new associative array of the same size and copy the contents of the associative array into it.

get
inout(V) get(inout(V[K]) aa, K key, lazy inout(V) defaultValue)

Looks up key; if it exists returns corresponding value else evaluates and returns defaultValue.

hashOf
size_t hashOf(auto ref T arg, size_t seed)
size_t hashOf(auto ref T arg)

Calculates the hash value of arg with an optional seed initial value. The result might not be equal to typeid(T).getHash(&arg).

keys
Key[] keys(T aa)

Returns a dynamic array, the elements of which are the keys in the associative array.

opEquals
bool opEquals(const Object lhs, const Object rhs)

Returns true if lhs and rhs are equal.

rehash
T rehash(T aa)

Reorganizes the associative array in place so that lookups are more efficient.

require
V require(ref V[K] aa, K key, lazy V value = V.init)

Looks up key; if it exists returns corresponding value else evaluates value, adds it to the associative array and returns it.

reserve
size_t reserve(ref T[] arr, size_t 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
void update(ref V[K] aa, K key, scope C create, scope U update)

Looks up key; if it exists applies the update delegate else evaluates the create delegate and adds it to the associative array

values
Value[] values(T aa)

Returns a dynamic array, the elements of which are the values in the associative array.

Properties

capacity
size_t capacity [@property getter]

(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.

dup
auto dup [@property getter]
T[] dup [@property getter]

Provide the .dup array property.

idup
immutable(T)[] idup [@property getter]
immutable(T)[] idup [@property getter]

Provide the .idup array property.

Structs

Interface
struct Interface

Information about an interface. When an object is accessed via an interface, an Interface* appears as the first entry in its vtbl.

ModuleInfo
struct ModuleInfo

An instance of ModuleInfo is generated into the object file for each compiled module.

OffsetTypeInfo
struct OffsetTypeInfo

Array of pairs giving the offset and type information for each member in an aggregate.

Templates

RTInfoImpl
template RTInfoImpl(size_t[] pointers)

Create RTInfo for type T

Variables

rtinfoNoPointers
enum immutable(void)* rtinfoNoPointers;

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

Meta

Authors

Walter Bright, Sean Kelly

Suggestion Box / Bug Report