3 Dec
2019
3 Dec
'19
10:30 p.m.
On 4/12/2019 09:50, Artyom Beilis wrote:
I think if input is nullptr than output can be nullptr as well.
Mostly this, when both sides are pointers. If one is a string type, so that you can't represent nullptr, then there's a couple of choices: 1. Use optional<string> so that you can explicitly represent the null state. This also acts as a hint to the user that the method has some special handling for the null case. 2. Treat an empty string as equivalent to nullptr. This would usually be safe (an empty filename is usually illegal, although an empty directory name is not). Either way will probably require conditional logic to bypass the normal conversion.