Mercurial > repos > public > sbplib_julia
diff src/LazyTensors/lazy_tensor_operations.jl @ 625:1c512e796c6d feature/volume_and_boundary_operators
Allow split_tuple to split tuples containing different types.
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Thu, 31 Dec 2020 08:10:56 +0100 |
parents | 8f7919a9b398 |
children | 76e5682d0e52 |
line wrap: on
line diff
--- a/src/LazyTensors/lazy_tensor_operations.jl Mon Dec 21 23:12:37 2020 +0100 +++ b/src/LazyTensors/lazy_tensor_operations.jl Thu Dec 31 08:10:56 2020 +0100 @@ -331,7 +331,7 @@ split_tuple((1,2,3,4),Val(3)) -> (1,2,3), (4,) ``` """ -function split_tuple(t::NTuple{N},::Val{M}) where {N,M} +function split_tuple(t::NTuple{N,Any},::Val{M}) where {N,M} return slice_tuple(t,Val(1), Val(M)), slice_tuple(t,Val(M+1), Val(N)) end @@ -341,7 +341,7 @@ Same as `split_tuple(t::NTuple{N},::Val{M})` but splits the tuple in three parts. With the first two parts having lenght `M` and `K`. """ -function split_tuple(t::NTuple{N},::Val{M},::Val{K}) where {N,M,K} +function split_tuple(t::NTuple{N,Any},::Val{M},::Val{K}) where {N,M,K} p1, tail = split_tuple(t, Val(M)) p2, p3 = split_tuple(tail, Val(K)) return p1,p2,p3