Methods
size
size_t size(var type);
Returns the associated size of a given type in bytes.
Examples
Usage
show($I(size(Int)));
show($I(size(Float)));
show($I(size(Array)));
Size
Type Size
The Size class is a very important class in Cello because it gives the size in bytes you can expect an object of a given type to be. This is used by many methods to allocate, assign, or compare various objects.
By default this size is automatically found and recorded by the Cello macro, but if the type does it's own allocation, or the size cannot be found naturally then it may be necessary to override this method.
Definition
struct Size {
size_t (*size)(void);
};
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