Result Class
template <typename T = void> class Utils::ResultResult<T> is used for returning either a success value or an error string from a function. More...
Header: | #include <Result> |
Detailed Description
The Result typedef is a shorthand for expected<T, QString>
, with the expected value of type T
being returned in the success case, and the unexpected value being an error message for the user.
Use Result<>
as the type when you do not have a concrete success value to return (do not use Result<bool>
). In that case, return Utils::ResultOk to return success. You can also use the convenience function Utils::makeResult to combine the success and error cases.
Return a Utils::ResultError value as a convenience class for the error case.
See also Utils::ResultOk, Utils::ResultError, and Utils::makeResult.
Copyright © The Qt Company Ltd. and other contributors. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.