The "size calculator" we support for parameters can either be missing - in which case we derive the size some other way - or it is required to return a valid value. But - what if the size calculator relies on an argument that is sometimes present and sometimes missing? Or what if the size can sometimes be determined with certainty and in other cases is ambiguous?
We should make the size calculator functions return an optional<size_t>, and the code which uses them to treat the case of a size calculator returning nullopt as it does the case of the parameter not having a size calculator to begin with.
The "size calculator" we support for parameters can either be missing - in which case we derive the size some other way - or it is required to return a valid value. But - what if the size calculator relies on an argument that is sometimes present and sometimes missing? Or what if the size can sometimes be determined with certainty and in other cases is ambiguous?
We should make the size calculator functions return an
optional<size_t>, and the code which uses them to treat the case of a size calculator returningnulloptas it does the case of the parameter not having a size calculator to begin with.