generic functions for size and eltype