Sze Howe Koh wrote: > 3) Pick one of the options above, but go one step further and use > std::optional (C++17) instead of returning null objects. I imagine this > should apply more broadly to the whole of Qt, not just the functions > discussed here.
IMHO, std::optional conceptually makes sense only for types that are not able to natively represent a null state. This is not the case for implicitly-shared data objects, which have a natural native null state (where the shared d pointer is null). So std::optional is redundant and introduces an unwanted distinction between a null optional and a null object. And it also means that at least a boolean flag is unnecessarily added somewhere in memory. Kevin Kofler _______________________________________________ Development mailing list Development@qt-project.org https://lists.qt-project.org/listinfo/development