c++ - Yaml-cpp,旧 api 到新 api,运算符 >>

标签 c++ yaml-cpp

我想将以下 Yaml-cpp 旧 api 格式的句子转换为新 api。如何将 doc["Meta"]["type"] >> type 转换为新 API,因为运算符 >> 在新 api 中被删除。谢谢

最佳答案

尝试以下操作:

typedef std::string MyType; // I believe, that you're retrieving string
MyType x = doc["Meta"]["type"].as<MyType>();

关于c++ - Yaml-cpp,旧 api 到新 api,运算符 >>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31918285/

相关文章:

c++ - 将 vector 转换为 Mat 中的行或 OpenCV 中的空 Mat 的有效方法?

c++ - Visual Studio 2012 : C++ compiler ignoring user-specified include directories

C++ 全局函数和 OOP?

c++ - 如何在 OpenCV 中编辑/更新 YAML 文件?

c++ - 在 C++ 和 Perl 之间使用的 YAML

c++ - 为什么在 SETcc 之前进行 XOR?

c++ - 在将 void* 转换为任何内容时,我应该使用 static_cast 还是 reinterpret_cast

c++ - 在 C++ 中解析 YAML 字典列表

c++ - yaml-cpp 出现编译器错误