On wtorek, 17 października 2017 17:28:54 CEST Marc Mutz wrote: > > (...) > > Discussion not finished > > I certainly hope so, because the above does not make any sense. See my > talk at QtWS. Returning QStringView is not different from c.begin() or > str.data(). You need to document the lifetime of the data, that's it. > (...)
As a person reading docs only if something is not working as expected, I'm pondering, if there is a way to document the lifetime without documentation. It seems that QStringView shares problems of raw pointers and raw pointers issue was mostly solved by different smart pointers. So why not returning one of these: QViewValidAsLongAsObjectFoo<QStringView> QViewValidUntilTheNextCall<QStringView> QViewValidAsLongMoonIsTheRightPhase<QStringView> Some of these could be enforced by asserts, some could be just for documenting the issue. Anyway, just an idea :-) Cheers, Jędrek _______________________________________________ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development