このページでは

Utils::Result Class

template <typename T = void> class Utils::Result

Result<T> は、関数から成功値またはエラー文字列のいずれかを返すために使用されます。詳細...

Header: #include <Result>

詳細な説明

Result 型定義は `expected<T, QString>` の省略形であり、成功した場合には `T ` 型の期待される値が返され、予期しない値が返された場合にはユーザーへのエラーメッセージとなります。

返す具体的な成功値がない場合は、型として `Result<> ` を使用してください(`Result<bool>`は使用しないでください)。その場合、成功を返すには `Utils::ResultOk ` を返します。また、便利関数 `Utils::makeResult ` を使用して、成功ケースとエラーケースを組み合わせることもできます。

エラーケース用の利便性クラスとして、Utils::ResultError 値を返してください。

Utils::ResultOk 、Utils::ResultError 、および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.