Permalink
Browse files

Added eltype for tuples when members all have the same type

  • Loading branch information...
1 parent 8dd632b commit 9a7215d5c15002b20ff90afc879ae8c647c21d46 @kmsquire kmsquire committed Nov 21, 2013
Showing with 4 additions and 0 deletions.
  1. +4 −0 base/tuple.jl
View
@@ -20,6 +20,10 @@ indexed_next(t::Tuple, i::Int, state) = (t[i], i+1)
indexed_next(a::Array, i::Int, state) = (a[i], i+1)
indexed_next(I, i, state) = done(I,state) ? throw(BoundsError()) : next(I, state)
+# eltype
+
+eltype{T}(x::(T...)) = T
+
## mapping ##
ntuple(n::Integer, f::Function) = ntuple(f, n) # TODO: deprecate this?

0 comments on commit 9a7215d

Please sign in to comment.