I wonder if the code below is legal.
Basically I have a
void LecagyFunction(int *data, int length)
for (int i = 0; i < length; i++)
std::cout << data[i] << std::endl;
This is not a hack, but a 100% legal (and expected) usage of vector. In C++11 your code should be rewritten to take advantage of
data() member - which is defined for empty vectors, unlike
And as a side note, above technique will not work for
vector<bool>, since the later does not follow properties of regular vectors (a terrible idea, as everybody understands now).