1

I've been writing an XML to JSON converter in C++ in Visual Studio 2012 and I've used std::next() a bunch in my program. Our professor wants us to be using Netbeans to submit out programs, but I went to bring my code over into Netbeans and now everywhere I've been using std::next is now underlined and my code wont compile. Here is an example of where I'm encountering an error. Does anyone know a workaround? Thanks in advance.

void element::printAttributesToFile(ofstream& outFile)
{
    map<string, string>::iterator it; //for iterating through the map of attributes and values

    if(attributes.size()>1) //if there are more than one attribute, make an array
    {
        outFile << "[" << endl;
    }
    for(it=attributes.begin(); it != attributes.end(); ++it) // iterates through the map
    {
        outFile << "{" << endl; //brackets surrounding ever attribute
        outFile<<"\""<<it->first<<"\": "<<  "\""<< it->second<<","<<endl; 
        if(!content.empty()){ // if there is content, print it
        outFile<<"\"content\": "<<  "\""<< content << "\"" <<endl; 
        }
        outFile << "}" << endl;
        if(next(it) != attributes.end()) //is this the last attribute
        {
            outFile << "," << endl; //if not, print the comma
        }else if(next(it)==attributes.end()){ //if it is
            outFile << endl; //print a new line
        }
    }
    if(attributes.size()>1) //closing the array
    {
        outFile << "]" << endl;
    }
    //outFile<<"]"<<endl;
}
Tyler Bainbridge
  • 249
  • 1
  • 2
  • 5

0 Answers0