小编use*_*593的帖子

我可以在 YAML 中连接别名吗?

我想做这样的事情:

opt-flags   : &opt_flags -DCMAKE_BUILD_TYPE=Release
dbg-flags   : &dbg_flags -DCMAKE_BUILD_TYPE=Debug
common-flags: &common    -DENABLE_EXAMPLES=ON -DENABLE_TESTS=ON 

# concatenate previous definitions to create composed definitions
dbg: *common *dbg_flags   
opt: *common *opt_flags
Run Code Online (Sandbox Code Playgroud)

这不能直接起作用。是否可以在 YAML 中执行与此等效的操作?

yaml

7
推荐指数
2
解决办法
7868
查看次数

How can I get the name of a node?

Is there a way to get the name of a node? For example:

Fruits:
   - apple
   - orange
   - pear
Run Code Online (Sandbox Code Playgroud)

and in C++:

YAML::Node fruit = parser["Fruits"];
cout << fruit.name() << endl;  // should print "Fruits"
Run Code Online (Sandbox Code Playgroud)

is there something like YAML::Node::name()? I don't see anything in Node.h that fits the bill.

If there isn't, any suggestions on a simple way to modify the code to record this information?

Thanks!

yaml-cpp

5
推荐指数
1
解决办法
1148
查看次数

标签 统计

yaml ×1

yaml-cpp ×1