Проблемы с итерацией. Я думаю, что проблема связана с правильностью const. Я предполагаю, что B :: getGenerate () должен быть const, чтобы этот код работал, но у меня нет контроля над B :: getGenerate ().
Любая помощь очень ценится.
Спасибо заранее,
JBU
Код следует:
int
A::getNumOptions() const
{
int running_total = 0;
BList::const_iterator iter = m_options.begin();
while(iter != m_options.end())
{
if(iter->getGenerate()) //this is the line of the error; getGenerate() returns bool; no const in signature
{
running_total++;
}
}
return running_total;
}
1>. \ A.cpp (118): ошибка C2662: «B :: getGenerate ()»: невозможно преобразовать указатель «this» из «const B» в «B &»