Initialise array without specific types

The first thing I try in these situations is work around this by using a functional style (mapreduce etc) that figures out the type itself. But without an MWE it is hard to suggest something specific.