std::array
has a template parameter for size. Two std::array
template instantiations with different sizes are different types. So you cannot have a pointer that can point to arrays of different sizes (barring void*
trickery, which opens its own can of worms.)
You could use templates for the client code, or use std::vector<int>
instead.
For example:
template <std::size_t N>
void do_stuff_with_array(std::array<int, N> the_array)
{
// do stuff with the_array.
}
do_stuff_with_array(SeedPositions32);
do_stuff_with_array(SeedPositions16);
Note that you can also get a pointer to the data:
int* ArrayPtr = SeedPositions32.data();
but here, you have lose the size information. You will have to keep track of it independently.