Closed ghost closed 3 years ago
@t0md3an This is because int
is not a polymorphic type. int
can only be used as:
a int
The <$T>
only applies to polymorphic types.
MyArray :: struct <$T> (items *$T, length usize)
main :: {
a <int> MyArray
}
This is equivalent templates in C++:
template <typename T>
struct Array {
T* items;
size_t length;
};
@IsaacShelton
result: