reuse variable inside yaml for use in c++

92 views Asked by At

I am trying to reuse a variable inside a yaml file which is then going to be read inside a c++ (visual studio). My attempt is not working at the moment. Here is my approach:

Inside yaml file:

testName: &./test.yaml 

Later in yaml file I am reusing the above variable like this:

varName: *testName

However, when I read the yaml file inside the c++, may variable varName is still being read as "+testName". I have googled quite a bit and this approach seems to be the standard one.

Is there something I need to change inside the c++ environement to read the reused variable correctly/appropriately?

ps: Big fan of stackoverflow, my first post here so, "Hello World!" :)

Multiple google suggested answers and standard approaches

1

There are 1 answers

2
flyx On

The correct syntax is

testName: &a ./test.yaml 
varName: *a

The anchor/alias name is completely independent from the key name in the mapping. You can use testName if you want:

testName: &testName ./test.yaml
varName: *testName