Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Not really an answer! I CAN'T reproduce the error neither with 2.4.12 nor 3.0.0 using this code:

void main(){
    vector<pair<uint, Point>> vec;
    pair<uint, Point> myFirstPair(3, Point(5, 6));
    pair<uint, Point> mySecondPair(87, Point(54, 67));
    vec.push_back(myFirstPair);
    vec.push_back(mySecondPair);

    FileStorage fs("mySavedFile.xml", FileStorage::WRITE);
    fs << "Positions" << "[";
    for (vector<pair<uint, Point>>::iterator i = vec.begin(); i != vec.end(); ++i)
    {
        fs << "{"
            << "Frame" << (int)i->first
            << "X" << i->second.x
            << "Y" << i->second.y
            << "}";
    }
    fs << "]";
}

Are you giving a name to the .xml/.yml file? I guessed that file in your FileStorage fs(file, FileStorage::WRITE); referred to a previously defined string but I'm not so sure now.

Not really an answer! I CAN'T reproduce the error neither either with 2.4.12 nor or with 3.0.0 using this code:

void main(){
    vector<pair<uint, Point>> vec;
    pair<uint, Point> myFirstPair(3, Point(5, 6));
    pair<uint, Point> mySecondPair(87, Point(54, 67));
    vec.push_back(myFirstPair);
    vec.push_back(mySecondPair);

    FileStorage fs("mySavedFile.xml", FileStorage::WRITE);
    fs << "Positions" << "[";
    for (vector<pair<uint, Point>>::iterator i = vec.begin(); i != vec.end(); ++i)
    {
        fs << "{"
            << "Frame" << (int)i->first
            << "X" << i->second.x
            << "Y" << i->second.y
            << "}";
    }
    fs << "]";
}

Are you giving a name to the .xml/.yml file? I guessed that file in your FileStorage fs(file, FileStorage::WRITE); referred to a previously defined string but I'm not so sure now.