问题
I've looked through the yaml-cpp documentation & source code and know that linking of anchored nodes is handled by yaml-cpp lib but I would still like to access the string value of anchor so I could reuse it as a id for the dictionary of anchor/node pair in my application.
---
- response: &list_01
- tim: Yes
- bill: hello
- selector:
- option: What?
response: *list_01
- option: Huh?
response:
- tim: Right ...
So for the following yaml document, I would get both the value list_01 along with the first response node (which is the map node which contains the list of maps).
Also is there a some kind built-in dictionary of anchor/node pairs (or a list of nodes that are used multiple times) functionality?
回答1:
It's not currently possible, but I've gotten a couple requests now, so you can follow the issue at http://code.google.com/p/yaml-cpp/issues/detail?id=110.
来源:https://stackoverflow.com/questions/6638802/retrieve-anchor-alias-string-in-yaml-cpp-from-document