11#ifndef INCGUARD_MGL_RESULT_WRAPPER_H_1611140530 
   12#define INCGUARD_MGL_RESULT_WRAPPER_H_1611140530 
   26template <
typename ErrorType, ErrorType noErrorValue = ErrorType(), ErrorType defaultErrorValue = noErrorValue>
 
   30    static constexpr ErrorType 
kNoError = noErrorValue;              
 
   49        : _error(defaultErrorValue)
 
 
   58    [[nodiscard]] 
constexpr ErrorType 
GetError() const noexcept
 
 
   69    [[nodiscard]] 
constexpr std::underlying_type_t<ErrorType> 
GetErrorCode() const noexcept
 
   71        return static_cast<std::underlying_type_t<ErrorType>
>(_error);
 
 
   80    constexpr void SetError(ErrorType error) 
noexcept 
 
   92        _error = noErrorValue;
 
 
  126    constexpr bool operator==(
const ErrorType &rhs) 
const noexcept 
  128        return _error == rhs;
 
 
  139    constexpr bool operator!=(
const ErrorType &rhs) 
const noexcept 
  141        return _error != rhs;
 
 
  151    [[nodiscard]] 
constexpr bool HasError() const noexcept
 
  153        return _error != noErrorValue;
 
 
 
エラーをラップするテンプレートクラス
Definition mgl_result_wrapper.h:28
 
constexpr void Success() noexcept
エラーを無効化
Definition mgl_result_wrapper.h:90
 
constexpr bool operator==(const ErrorType &rhs) const noexcept
エラーの等価演算子
Definition mgl_result_wrapper.h:126
 
constexpr ResultWrapper() noexcept
コンストラクタ
Definition mgl_result_wrapper.h:48
 
constexpr bool HasError() const noexcept
エラーが発生しているかを取得
Definition mgl_result_wrapper.h:151
 
constexpr ResultWrapper & operator=(const ErrorType &rhs) noexcept
エラーの代入演算子
Definition mgl_result_wrapper.h:112
 
static constexpr ErrorType kNoError
エラーが発生していない事を表す値
Definition mgl_result_wrapper.h:30
 
constexpr bool operator!=(const ErrorType &rhs) const noexcept
エラーの不等価演算子
Definition mgl_result_wrapper.h:139
 
constexpr std::underlying_type_t< ErrorType > GetErrorCode() const noexcept
エラーコードを取得
Definition mgl_result_wrapper.h:69
 
constexpr ResultWrapper(ErrorType error) noexcept
エラー設定用コンストラクタ
Definition mgl_result_wrapper.h:39
 
static constexpr ErrorType kDefaultError
エラーの初期値
Definition mgl_result_wrapper.h:31
 
constexpr ErrorType GetError() const noexcept
エラーを取得
Definition mgl_result_wrapper.h:58
 
constexpr void SetError(ErrorType error) noexcept
エラーを設定
Definition mgl_result_wrapper.h:80
 
static constexpr ResultWrapper Succeeded() noexcept
エラーのないオブジェクトを取得
Definition mgl_result_wrapper.h:101
 
constexpr bool IsSucceeded() const noexcept
エラーが発生していないかを取得
Definition mgl_result_wrapper.h:164