len
size_t len(var self);
Returns the length of object self
.
Usage
var x = new(Array, Int, $I(1), $I(2), $I(5));
show($I(len(x))); /* 3 */
var y = $S("Test");
show($I(len(y))); /* 4 */
Has a length
The Len
class can be implemented by any type that has a length associated with it. It is typically implemented by collections and is often used in conjunction with Iter
or Get
.
struct Len {
size_t (*len)(var);
};