I'm trying to parse a simple array

Help
Terje Loe
2012-06-07
2013-06-12
  • Terje Loe
    Terje Loe
    2012-06-07

    Relevant json:

                    "Frustrum" : [
                        0,
                        0.785,
                        1.333333333333333,
                        0.1,
                        100.0
                    ]
    

    Relevant code:

                const JSONNode& frustrumArray = jsonNode["Frustrum"];
                std::string test = frustrumArray.write();
                if (frustrumArray.at(0).as_int() == FrustrumType::FromFov)
                {
                    cam->SetFrustrum(static_cast<Real>(frustrumArray.at(1).as_float()),
                                     static_cast<Real>(frustrumArray.at(2).as_float()),
                                     static_cast<Real>(frustrumArray.at(3).as_float()),
                                     static_cast<Real>(frustrumArray.at(4).as_float()));
                }
    

    I'm getting a string iterator is not dereferenceable assertion error here.. its in line 144 in JSONWorker.cpp.. test is set to "" .. what am I doing wrong?

     
  • I'm looking into it, I'm not sure why you are getting an assertion error

     
  • Terje Loe
    Terje Loe
    2012-07-01

    Are you able to reproduce it?

     
  • No, I can't.  What compiler and platform are you on?

     

  • Anonymous
    2012-07-18

    @bloony, are you using MSVC? I have seen similar assertions using MSVC but not in the spot you mentioned. What compile options are you using - in particular, JSON_PREPARSE?