# How to specify a type of Vector, SVector, OR Tuple of a certain type, such as Int?

**URL:** <https://discourse.julialang.org/t/how-to-specify-a-type-of-vector-svector-or-tuple-of-a-certain-type-such-as-int/62537>\
**Category:** General Usage\
**Created:** [June 7, 2021, 6:30pm UTC](https://discourse.julialang.org/t/how-to-specify-a-type-of-vector-svector-or-tuple-of-a-certain-type-such-as-int/62537 "2021-06-07T18:30:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jinml](https://avatars.discourse-cdn.com/v4/letter/j/91b2a8/32.png) [@jinml](https://discourse.julialang.org/u/jinml)\
**Post date:** [June 7, 2021, 6:30pm UTC](https://discourse.julialang.org/t/how-to-specify-a-type-of-vector-svector-or-tuple-of-a-certain-type-such-as-int/62537/1 "2021-06-07T18:30:43Z")

</div>

I’d like the function to take a `Vector`, an `SVector` or `Tuple` of certain eltype, and unspecified length, what is the most concise type qualifier?  
Thanks,

---

<div class="post-metadata">

**Author:** ![simeonschaub](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/simeonschaub/32/216566_2.png) [@simeonschaub](https://discourse.julialang.org/u/simeonschaub)\
**Post date:** [June 7, 2021, 6:38pm UTC](https://discourse.julialang.org/t/how-to-specify-a-type-of-vector-svector-or-tuple-of-a-certain-type-such-as-int/62537/2 "2021-06-07T18:38:48Z")

</div>

You probably want `Union{AbstractVector{T}, Tuple{Vararg{T}}} where {T}`. If you need to write this more often, you can also create an alias:

```julia
VectorLike{T} = Union{AbstractVector{T}, Tuple{Vararg{T}}}

```

and then dispatch on that.

---

<div class="post-metadata">

**Author:** ![jinml](https://avatars.discourse-cdn.com/v4/letter/j/91b2a8/32.png) [@jinml](https://discourse.julialang.org/u/jinml)\
**Post date:** [June 7, 2021, 6:41pm UTC](https://discourse.julialang.org/t/how-to-specify-a-type-of-vector-svector-or-tuple-of-a-certain-type-such-as-int/62537/3 "2021-06-07T18:41:18Z")

</div>

Thanks @simeonschaub Btw, what is the most concise way of converting any one of them to an SVector{T} ?

---

<div class="post-metadata">

**Author:** ![simeonschaub](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/simeonschaub/32/216566_2.png) [@simeonschaub](https://discourse.julialang.org/u/simeonschaub)\
**Post date:** [June 7, 2021, 6:44pm UTC](https://discourse.julialang.org/t/how-to-specify-a-type-of-vector-svector-or-tuple-of-a-certain-type-such-as-int/62537/4 "2021-06-07T18:44:15Z")

</div>

Just `SVector{length(x), T}(x)` should work, but note that this won’t be type stable for `Vector`s.
