Hello everyone. Assume I have an immutable like:
immutable Foo{M, N, T} a::NTuple{M, T} b::NTuple{N, T} end and I want to make an efficient getindex into the tuple. Something that would probably be inefficient due to branching would be: function Base.getindex{M, N}(f::Foo({M,N}), i) if i <= M return f.a[i] else return f.b[i - N] end end Is there anyway I can just grab the value at the address at an offset i - 1 further forward of the address of f.a[1]. In my head this would be more efficient since it would be a very simple offset calculation. You can assume that T is a nice bits type like a Float32. Thanks! // Kristoffer