Hi, there are good examples to convert NamedTupes to Dict and vice versa etc. But in e.g. Optim’s minimize, I would like to go from a single vector to a NamedTuple.I was wondering if this case has a proven solution?

I came up with:

```
function vec2nt(v::Vector, nt::T) where {T <: NamedTuple}
pv = Vector{UnitRange{Int64}}(undef, length(nt))
indx = 0; start = 1
for key in keys(nt)
indx += 1
pv[indx] = start:start-1+length(nt[key])
start = start+length(nt[key])
end
println(pv)
t = [v[pv[i]] for i in 1:length(pv)]
nnt =NamedTuple{keys(nt), typeof(values(nt))}(t)
end
v = [6,7,8,9,10, 11, 12]
nt = (a=[1, 2], b=[3,4,5], c=[6, 7])
vec2nt(v, nt)
```