so I want to write every element in the vector till it reaches an empty element(which is 0) using iterators , when i try to compile the program i have those two errors:
1.'empty' : is not a member of 'std::_Vector_const_iterator<std::_Vector_val<std::_Simple_types<int>>>'
2.invalid return type 'const int *' for overloaded 'operator ->'
1 2 3 4 5 6 7 8 9 10 11 12 13 14
#include <iostream>
#include <vector>
usingnamespace std;
int main()
{
vector<int> test{ 1, 2, 3, 0, 4, 0, 0, 5 };
for (auto it = test.cbegin();
it != test.cend() && !it->empty(); ++it)
cout << *it << endl;
cin.ignore(2, ' ');
}