For given vector iterators. Does this code compile? If it fails, please choose the lines on which it does.
vector<int> vec(3,1);
const std::vector<int>::iterator iter = vec.begin();
*iter = 10; //1
++iter;      //2
std::vector<int>::const_iterator iter2 = vec.begin();
*iter2 = 10;//3
++iter2;     //4
Explanation
const_iterator don't allow you to change the values that they point to ( std::vector::const_iterator )
const std::vector::iterator - iterator isn’t allowed to point to something different, but the thing it points to may be modified.

Следи за CodeGalaxy

Мобильное приложение Beta

Get it on Google Play
Обратная Связь
Cosmo
Зарегистрируйся сейчас
или Подпишись на будущие тесты