Skip to content

[ParameterTree] Allow extracting empty subtree from const tree

The ParameterTree currently throws an error when you try to access a non-existing subtree of a const ParameterTree. This is pretty inconvenient when you have sensible defaults for most parameters in your ini file and only want to specify those groups where you actually want to prescribe non-default values.

This patch changes the const version of the sub() method to instead return an empty tree in this case by default. For this purpose, the ParameterTree class now contains an empty tree singleton.

The method carries an additional optional bool parameter that defaults to false, but can be set to true to retain the old behavior.

Merge request reports