« Home » « Learn » « Download » « Github »

logo

Cello High Level C

Methods

cast

var cast(var self, var type);

Ensures the object self is of the given type and returns it if it is.

Examples

Usage

var x = $I(100);
struct Int* y = cast(x, Int);
show(y);

Cast


Runtime Type Checking

The Cast class provides a rudimentary run-time type checking. By default it simply checks that the passed in object is of a given type but it can be overridden by types which have to do more complex checking to ensure the types are correct.

Definition

struct Cast {
  var (*cast)(var, var);
};

Derivers

  • Array |     Sequential Container
  • Box |     Unique Pointer
  • Exception |     Exception Object
  • File |     Operating System File
  • Filter |     Filtered Iterable
  • Float |     Floating Point Object
  • Function |     Function Object
  • GC |     Garbage Collector
  • Int |     Integer Object
  • List |     Linked List
  • Map |     Apply Function to Iterable
  • Mutex |     Mutual Exclusion Lock
  • Process |     Operating System Process
  • Range |     Integer Sequence
  • Ref |     Shared Pointer
  • Slice |     Partial Iterable
  • String |     String Object
  • Table |     Hash table
  • Thread |     Concurrent Execution
  • Tree |     Balanced Binary Tree
  • Tuple |     Basic Collection
  • Type |     Metadata Object
  • Zip |     Multiple Iterator

Implementers


Back