# How to make a vector of parametric composite types?

**URL:** <https://discourse.julialang.org/t/how-to-make-a-vector-of-parametric-composite-types/2439>\
**Category:** New to Julia\
**Created:** [March 4, 2017, 1:35pm UTC](https://discourse.julialang.org/t/how-to-make-a-vector-of-parametric-composite-types/2439 "2017-03-04T13:35:11Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![mkborregaard](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkborregaard/32/556_2.png) [@mkborregaard](https://discourse.julialang.org/u/mkborregaard)\
**Post date:** [March 6, 2017, 1:28pm UTC](https://discourse.julialang.org/t/how-to-make-a-vector-of-parametric-composite-types/2439/6 "2017-03-06T13:28:20Z")

</div>

So I am not sure exactly what you want. Maybe instead you are looking for something like this?

```julia
@enum Material Sic Al Vac

immutable Layer
   material::Material
   thickness::Float64
end

permittivity(l::Layer) = permittivity(Val{l.material})

function permittivity(::Type{Val{Al}})
   println("The permittivity of Aluminum is grand indeed")
end

function permittivity(::Type{Val{Sic}})
   println("But even grander is Silicium")
end

#Then
l = Layer(Al, 4)
permittivity(l)
l2 = Layer(Sic, 4)
permittivity(l2)

```

```julia
@time ml = [Layer(Al,0.0) ; Layer(Vac,0.0)]
  0.000008 seconds (7 allocations: 336 bytes)

```

---

_[View the full topic](https://discourse.julialang.org/t/how-to-make-a-vector-of-parametric-composite-types/2439)._
