1

I was trying to access a frame that has X and Y co-ordinates using yaml. Things were working fine when I had &frame_node instead of *frame_node, but for using the FindValue function I had to use *frame_node. However, frame_node[0], frame_node[1], etc., give me an error now. Could you please help me to solve this issue?

if (const YAML::Node *frame_node = config_node.FindValue("frame")) {
   //const YAML::Node &frame_node = config_node["frame"];
   std::cout << "Hello" << std::endl;
   hasCard = 1 ; 
   // X-coordinates.
   frame_node[0] >> x[0];
   frame_node[1] >> x[1];
   frame_node[2] >> x[2];
   frame_node[3] >> x[3];
   // Y-coordinates.
   frame_node[4] >> y[0];
   frame_node[5] >> y[1];
   frame_node[6] >> y[2];
   frame_node[7] >> y[3];
}

1 Answer 1

1

frame_node is a pointer, so frame_node[1] will give you pointer arithmetic. You want (*frame_node)[1].

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.