I have a bunch of structs like:
struct A { ... }
struct B { ... }
struct C { ... }
I want to devise a function that can accept arrays of these structs and iterate through each element of the array and call another function like:
template <typename T>
ostream& process(ostream& os, const T* array) {
// output each element of array to os (but how do we know the length?)
}
A a_array[10];
// in practice, this is actually operator<<, so I cannot pass in the
// size explicitly
process(..., a_array);
Update: I cannot use any of the std containers here. It has to be an array unfortunately!
std::vectororstd::array?