eltype
eltype(type)
Determine the type of the elements generated by iterating a collection of the given type
. For associative collection types, this will be a Pair{KeyType,ValType}
. The definition eltype(x) = eltype(typeof(x))
is provided for convenience so that instances can be passed instead of types. However the form that accepts a type argument should be defined for new types.
Examples
julia> eltype(Int[1,2,3])
Int64
julia> enum = enumerate(arr);
julia> eltype(enum)
(Int64,Int64)
julia> dict = {"a"=>1, "b"=>2}; # a dictionary
julia> eltype(dict)
(Any,Any)
julia> eltype(Set({"a","b"}))
Any
See Also
BigFloat, BigInt, Dict, eltype, fieldtype, Float32, Float64, IntSet, isa, isalnum, isalpha, isascii, iseltype, isequal, isgraph, isimmutable, isinteractive, isleaftype, isnull, ispunct, isspace, issubtype, keytype, Nullable, NullException, promote_type, typeintersect, typejoin, typemax, typemin, typeof, Val, valtype,User Contributed Notes
Add a Note
The format of note supported is markdown, use triple backtick to start and end a code block.