map<string, list<int> >
リストを反復処理して各番号を出力したいがあります。const_iterator と iterator の間の変換に関するコンパイル エラーが発生し続けます。私はこれで何が間違っていますか?
for (map<string, list<int> >::iterator it = words.begin(); it != words.end(); it++)
{
cout << it->first << ":";
for (list<int>::iterator lit = it->second.begin(); lit != it->second.end(); lit++)
cout << " " << intToStr(*lit);
cout << "\n";
}
error: conversion from
‘std::_Rb_tree_const_iterator<std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::list<int, std::allocator<int> > > >’
to non-scalar type
‘std::_Rb_tree_iterator<std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::list<int, std::allocator<int> > > >’
requested|