Originally Posted by
Geof
Hi,
I have a problem with a constant iterator. This is an example of the situation
class B
{
public:
B(){}
std::list<int> m_List;
std::list<int>::iterator Iter;
const int Func ( ) const
{
std::list<int>::iterator IterFunc;
IterFunc = m_List.begin ( );
return 2;
}
};
int main ( )
{
B ObjB;
ObjB.Func ( );
return 0;
}
I have this compilation error
error C2679: binary '=' : no operator found which takes a right-hand operand of type 'std::list<_Ty>::_Const_iterator<_Secure_validation>' (or there is no acceptable conversion)
If I remove the const at the end of Func it solves the problem but I need this function to be const. How I can solve this problem
Thank you