C++ ptree迭代器成员未被自动完成识别?
我正在使用boost库解析.ini文件,该文件如下所示:C++ ptree迭代器成员未被自动完成识别?,c++,pointers,boost,autocomplete,ptree,C++,Pointers,Boost,Autocomplete,Ptree,我正在使用boost库解析.ini文件,该文件如下所示: [head] type1=val1 type2=cal2 ... 我的代码是: #include <iostream> #include <string> #include <boost/property_tree/ptree.hpp> #include <boost/property_tree/ini_parser.hpp> using namespace std; int main(
[head]
type1=val1
type2=cal2
...
我的代码是:
#include <iostream>
#include <string>
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/ini_parser.hpp>
using namespace std;
int main()
{
using boost::property_tree::ptree;
boost::property_tree::ptree pt;
boost::property_tree::ini_parser::read_ini("test.ini", pt);
boost::property_tree::ptree::iterator pos1,pos2;
for(pos1 = pt.begin(); pos1 != pt.end() ; ++pos1)
{
cout << pos1->first << endl;
for(pos2 = pos1->second.begin() ; pos2 != pos1->second.end() ; ++pos2)
{
cout << " " << pos2->first << "=" << pos2->second.get_value<string>() << endl;
}
cout << endl;
}
return 0;
}
一切正常,程序输出如预期,但eclipse将所有pos1和pos2->标记为错误。。。intelli sense不会加载第一个或第二个选项,并将它们的所有使用标记为错误。。。然而,一切都在汇编
有什么想法吗
下面是它的外观:
pos1和pos2不是指针,应该使用。与->hi Eric不同的是,也许我不太理解itrator concept,但在我看来,pos1和pos2是指向它们正在迭代的同一类型的指针,至少对我来说,数组和向量迭代器是这样工作的。不管怎样,当我只使用pos1时。我得到了很多迭代器属性和方法,但没有任何ptree的。。。。