What I am trying to do is not very straight forward, maybe it is easier if I start with the result and then explain how I am trying to get there.
I have a struct with two fields:
struct data{T}
point::T
mat::Array
end
What I would like to do is nest this and make the field mat self-referential to get something like this:
data{data{Int64}}(data{Int64}(1, [1]), [1])
The 'outer' type should not store [1] but reference to the innermost mat. I am not sure if this makes sense or is even possible. The field mat should store the same large array repeatedly.
I have tried something like this (n is the number of nested types.
struct data{T}
point::T
g::Array
function D(f, g, n)
for i = 1:n
(x = new{T}(f, g); x.f = x)
end
end
end
Again I am not sure if I understand self-referential constructors enough, or if this is possible. Any help/clarification would be appreciated, thanks!