You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `key` used by a `__map_<key>` segment does not need to be defined at the root namespace level. It can also be a **sibling** within the same struct, or defined anywhere in a parent scope.
390
+
This allows you to co-locate the key array alongside the map it controls:
391
+
392
+
```yaml
393
+
cpp_name_space:
394
+
# key array defined as a sibling of the map that uses it
395
+
nested_map:
396
+
entries:
397
+
type: string_array
398
+
default_value: ["entry1", "entry2"]
399
+
description: "Keys for the nested map"
400
+
__map_entries: # resolved to nested_map.entries (sibling scope)
401
+
value:
402
+
type: double
403
+
default_value: 1.0
404
+
description: "A value keyed by entries"
405
+
```
406
+
407
+
> **Note:** Scope resolution searches the current struct first, then walks up to parent scopes. If the key array is not found in any scope, the bare name is used as a fallback.
408
+
387
409
### Use generated struct in Cpp
388
410
The generated header file is named based on the target library name you passed as the first argument to the cmake function.
389
411
If you specified it to be `turtlesim_parameters` you can then include the generated code with `#include <turtlesim/turtlesim_parameters.hpp>`.
0 commit comments