Why am i getting an error here, the !b->empty() gives error
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#include <iostream>
#include <string>
#include <vector>
using std::cin; using std::cout; using std::endl; using std::string;
using std::vector;
int main()
{
string text = "words that are writen here are lowercase";
if (text.begin() != text.end()) {
for (string::iterator b = text.begin(); b!= text.end() && !b->empty(); ++b) {
}
}
cin.sync();
cin.get();
return 0;
}
this is one of the questions i got where the program needs to know its reached a newline using iterators, the char itself doesnt have the empty funtion but dereferencing it like this does
(*b).empty() which is the same as b->empty() both give same error