我试图从一组向量中打印出每个向量中的所有元素。构建失败,但错误发生在头文件的某处,恐怕我根本不了解错误代码。任何帮助将不胜感激!这是错误:
error: invalid conversion from 'const std::basic_string<char, std::char_traits<char>, std::allocator<char> >* const' to 'std::basic_string<char, std::char_traits<char>, std::allocator<char> >*'
这是导致问题的代码。
multiset<vector < string > > setOfRules;
vector<string> testing,testing2;
testing.push_back("bar");
testing.push_back("foo");
testing2.push_back("foo2");
testing2.push_back("bar2");
setOfRules.insert(testing);
setOfRules.insert(testing2);
for (multiset< vector <string > >::iterator myIterator = setOfRules.begin();
myIterator!=setOfRules.end();
++myIterator)
{
for (vector< string >::iterator myOtherIterator = ( *myIterator ).begin();
myOtherIterator != ( *myIterator ).end();
++myOtherIterator)
{
cout << *myOtherIterator << " " ;
}
cout << endl;
}