ocean.core.TypeConvert

Functions to help with type conversion.

Members

Classes

A
class A
Undocumented in source.
B
class B
Undocumented in source.
C
class C
Undocumented in source.

Functions

assumeUnique
immutable(T)[] assumeUnique(T[] input)

Trivial wrapper for a cast from any array to an array of immutable elements (e.g. from any string to an immutable string), to make code more readable. Its use is only legal if no one else has a reference to the contents of the input array. Cf. std.exception.assumeUnique in Phobos.

assumeUnique
immutable(T)[] assumeUnique(T[] input)
Undocumented in source. Be warned that the author may not have intended to support it.
downcast
To downcast(From value)

Casts an object of one class to another class. Using this function is safer than a plain cast, as it also statically ensures that the variable being cast from is a class or an interface.

testToDgBad
int testToDgBad(int x)
Undocumented in source. Be warned that the author may not have intended to support it.
testToDgBar
void testToDgBar(int a, int b)
Undocumented in source. Be warned that the author may not have intended to support it.
testToDgFoo
int testToDgFoo()
Undocumented in source. Be warned that the author may not have intended to support it.
toContextDg
ReturnTypeOf!(F) delegate() toContextDg(void* context)

Generates delegate that stores specified context as a delegate context pointer and, when called, forwards it to function F as a regular argument.

toDg
ReturnTypeOf!(Func) delegate(ParametersOf!(Func)) toDg(Func f)

Helper function to wrap any callable type in a delegate. Most useful when you need to pass function pointer as a delegate argument.

Interfaces

I
interface I
Undocumented in source.

Static variables

_arrayOf_global_scope
auto _arrayOf_global_scope;
Undocumented in source.

Templates

arrayOf
template arrayOf(T)

Creates a new array from the elements supplied as function arguments, casting each of them to T.

castFrom
template castFrom(From)

Explicit cast function -- both from and to types must be specified by the user and are statically ensured to be correct. This extra security can help prevent refactoring errors.

Meta

License

Boost Software License Version 1.0. See LICENSE_BOOST.txt for details. Alternatively, this file may be distributed under the terms of the Tango 3-Clause BSD License (see LICENSE_BSD.txt for details).