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. License:Boost License 1.0. Authors:
Walter Bright, Sean Kelly
- All D class objects inherit from Object.
- Convert Object to a human readable string.
- Compute hash function for Object.
- Compare with another Object obj.
Returns:
this < obj < 0 this == obj 0 this > obj > 0 this < obj < 0 this == obj 0 this > obj > 0 - Returns !=0 if this object does have the same contents as obj.
- Create instance of class specified by classname.
The class must either have no constructors or have
a default constructor.
Returns:
null if failed
- Returns true if lhs and rhs are equal.
- Information about an interface. When an object is accessed via an interface, an Interface* appears as the first entry in its vtbl.
- Runtime type information about a class. Can be retrieved for any class type or instance by using the .classinfo property. A pointer to this appears as the first entry in the class's vtbl[].
- Array of pairs giving the offset and type information for each
member in an aggregate.
- Offset of member from start of object
- TypeInfo for this member
- Runtime type information about a type.
Can be retrieved for any type using a
TypeidExpression.
- Returns a hash of the instance of a type.
- Compares two instances for equality.
- Compares two instances for <, ==, or >.
- Returns size of the type.
- Swaps two instances of the type.
- Get TypeInfo for 'next' type, as defined by what kind of type this is, null if none.
- Return default initializer. If the type should be initialized to all zeros, an array with a null ptr and a length equal to the type size will be returned.
- Get flags for type: 1 means GC should scan for pointers
- Get type information on the contents of the type; null if not available
- Run the destructor on the object and all its sub-objects
- Run the postblit on the object and all its sub-objects
- Return alignment of type
- Return info used by the garbage collector to do precise collection.
- Runtime type information about a class. Can be retrieved from an object instance by using the .classinfo property.
- The base class of all thrown objects.
All thrown objects must inherit from Throwable. Class Exception, which
derives from this class, represents the category of thrown objects that are
safe to catch and handle. In principle, one should not catch Throwable
objects that are not derived from Exception, as they represent
unrecoverable runtime errors. Certain runtime guarantees may fail to hold
when these errors are thrown, making it unsafe to continue execution after
catching them.
- A message describing the error.
- The file name and line number of the D source code corresponding with where the error was thrown from.
- The stack trace of where the error happened. This is an opaque object that can either be converted to string, or iterated over with foreach to extract the items in the stack trace (as strings).
- A reference to the next error in the list. This is used when a new Throwable is thrown from inside a catch block. The originally caught Exception will be chained to the new Throwable via this field.
- Overrides the default trace hander with a user-supplied version.
Parameters:
TraceHandler h The new trace handler. Set to null to use the default handler. - Return the current trace handler
- This function will be called when an exception is constructed. The
user-supplied trace handler will be called if one has been supplied,
otherwise no trace will be generated.
Parameters:
Returns:void* ptr A pointer to the location from which to generate the trace, or null if the trace should be generated from within the trace handler itself.
An object describing the current calling context or null if no handler is supplied. - The base class of all errors that are safe to catch and handle.
In principle, only thrown objects derived from this class are safe to catch
inside a catch block. Thrown objects not derived from Exception
represent runtime errors that should not be caught, as certain runtime
guarantees may not hold, making it unsafe to continue program execution.
- Creates a new instance of Exception. The next parameter is used internally and should be always be null when passed by user code. This constructor does not automatically throw the newly-created Exception; the throw statement should be used for that purpose.
- Destroys the given object and puts it in an invalid state. It's used to destroy an object so that any cleanup which its destructor or finalizer does is done and so that it no longer references any other objects. It does not initiate a GC cycle or free any GC memory.
- (Property) Get the current capacity of an array. The capacity is the number of elements that the array can grow to before the array must be extended/reallocated.
- Try to reserve capacity for an array. The capacity is the number of elements that the array can grow to before the array must be extended/reallocated. The return value is the new capacity of the array (which may be larger than the requested capacity).
- 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. Use this only when you are sure no elements are in use beyond the array in the memory block. If there are, those elements could be overwritten by appending to this array. Calling this function, and then using references to data located after the given array results in undefined behavior.
- Helper function used to see if two containers of different types have the same contents in the same sequence.
- Create RTInfo for type T