The product config has been edited for five years by anyone passing by: six levels of nesting, half the keys optional, zero docs. The current reader is a staircase of if (node != nullptr) and still crashes on staging every Thursday. The PM says 'just make it not crash'. std::optional is your way off the staircase.
Implement getConfigValue — a function that reads a nested config value by dot-separated path, returning std::nullopt if any node in the chain is missing. No exceptions, no raw null checks scattered around.
std::optional throughout"") returns the root's value if it has onestd::optional model "value or nothing"?optional::value() and optional::value_or()?Split the path on . and walk the children map level by level.
At each step, if the key is missing return std::nullopt; at the end return the node's value.
Hit Submit (or ⌘/Ctrl + ↵) — test results will show up here.