1

I am using Yaml-Cpp to generate the input string to begin with. It seems I am somehow generating an incorrect serialization of the vector, though, because when I try to access that member from a loaded Yaml Node, I get "TypedBadConversion".

Entirely besides helping understand how to generate the Yaml to begin with (which I am interested in as well!) does anyone see why the string in question is invalid? Here is a test program and its output:

Test Program

#include <yaml-cpp/yaml.h>
using namespace YAML;
using namespace std;
int main( int argc, char* argv[] )
{
std::string         Command( "- ./rsc/cudaExample0.sh\n- 10.62.4.214/16\n- 2.0.19.136\n- 5000\n- 5000\n- 0\n-\n  - b\n  - i\n  - n\n  - \" \"\n  - \"-\"\n  - t\n  - \" \"\n- 72" );
YAML::Node          Test = Load( Command );
std::vector<char>   Payload;
    Payload = Test[6].as<std::vector<char> >();
    std::cout << Payload[1] << std::endl;
return 0;
}

Output

Starting /noname/src/testyaml/TestYaml...
terminate called after throwing an instance of 'YAML::TypedBadConversion<char>'
  what():  yaml-cpp: error at line 0, column 0: bad conversion
The program has unexpectedly finished.
/noname/src/testyaml/TestYaml exited with code 0
4

1 回答 1

3

这是 yaml-cpp 中的一个错误;我在项目页面上打开了一个问题,它已在存储库的提示中修复。

于 2013-11-10T20:53:16.070 回答