int num = 0;
list::iterator it;
for(it = binary.const_iterator; it !=binary.end(); ++it) {
if(*it == ‘1’) {
abc.push_back(copyoflist.at(num));
}
num++;
}
Here binary is defined as list binary;
copyoflist is a char type vector.
I am getting this error:
invalid use of ‘std::list >::const_iterator’
on the line
for(it = binary.const_iterator; it !=binary.end(); ++it)
Am not able to figure out what is going wrong. Can someone help me out ?
const_iteratoris a type, not a property. You would use it like this: