Pergunta

The following test code does not remove an element from the list as expected:

YAML::Node node = YAML::Load("[1,2,3]");
node.remove(1); // expect that this should remove the middle element from the list

ofstream ofs("test.yml");
ofs << node;
ofs.close();

The test output file contains:

-1
-2
-3

It appears that the file contains the value from the original list and the element was not removed. What is the correct way to remove an element from a list?

Foi útil?

Solução

There's no way to do this now (I didn't think of this!). I've filed a bug (http://code.google.com/p/yaml-cpp/issues/detail?id=190), but I'm not sure what the syntax should be. Please comment on that issue if you have suggestions!

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top