ptree iterator members not identifed by autocomplete?

86 views Asked by At

I am using boost library to parse .ini file that looks like:

[head]
type1=val1
type2=cal2
...

My code is this:

#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;
}

everything works and the program output is as expected but eclipse marks all pos1 and pos2 "->" as errors... the intelli sense doesn't load the "first" or "second" options and mark all uses of them as error... yet everything compiles...

any ideas ??

here is how it looks:

enter image description here

1

There are 1 answers

1
Eric On

pos1 and pos2 are not pointers, you should use the . instead of ->