If using an action() to convert the input values into custom data types, the default value poses an issue when using choices(). m_choices is a vector<string> so the default value also has to be comparable to a string, for the given value to be accepted.
This commit solves this by patching get() to convert the default value using the same action().
It is not the cleanest solution (default value has to be given as string instead of the target type), but the alternative I came up with would have changed m_choices to a typed vector which would have had wider consequences so I didn't pursue that path.
If using an
action()
to convert the input values into custom data types, the default value poses an issue when usingchoices()
.m_choices
is avector<string>
so the default value also has to be comparable to a string, for the given value to be accepted.This commit solves this by patching
get()
to convert the default value using the sameaction()
.It is not the cleanest solution (default value has to be given as string instead of the target type), but the alternative I came up with would have changed
m_choices
to a typed vector which would have had wider consequences so I didn't pursue that path.