Skip to content

Add special internal constructor for empty static parameter tree

Some times I get errors from the parameter tree saying that a key does not exist. Some times the diagnostic says the prefix and some times it doesn't. They prefix is constructed when calling sub(key) and there are two things that contribute to having two different diagnostics:

  • If the parameter tree already has the sub-tree, a proper parameter tree is returned and the prefix is correctly set up.
  • If there is not sub-tree, it depends on whether the current parameter tree is const:
    • If const (i.e., sub(key) const), it returns a static empty parameter tree and no prefix can be constructed there.
    • If mutable (i.e., sub(key)), it builds a new tree and stores it into its map of subtrees.

In my opinion, the behavior of sub(key) and sub(key) const is surprising because sub(key) modifies the internal state.

So, as a band aid for this problem, I just added an extra constructor to at least indicate that the prefix cannot be reconstructed.

Merge request reports

Loading