How would you use array methods such as .size() and .empty() in a function if you can only pass pointers to the array, since pointers just point to the first element?
I'm specifically asking about using array methods and not about finding ways to check the array size or whether the array is empty.
For example, how would you get array.empty() in the code below to work?
class Solution{
public:
void testArray(int &array)[5]){ //or (int* array) or (int array[])
std::cout << array.empty() << std::endl;
}
}
int main(int argc, const char * argv[])
{
int a1[] = {1,2,3,4,5};
Solution s1;
s1.testArray(a1);
}