11 enum class NullableInit
18 template<
typename ResultType >
23 std::string ErrorString;
30 , Value( ResultType() )
37 , Value( ResultType() )
42 : ErrorString(
std::move( error ) )
44 , Value( ResultType() )
49 : Value(
std::move( result ) )
54 : ErrorString( other.ErrorString )
55 , IsValid( other.IsValid )
56 , Value( other.Value )
60 : ErrorString(
std::move( other.ErrorString ) )
61 , IsValid( other.IsValid )
62 , Value(
std::move( other.Value ) )
68 IsValid = other.IsValid;
69 ErrorString = other.ErrorString;
74 Value = std::move( other.Value );
75 IsValid = other.IsValid;
76 ErrorString = std::move( other.ErrorString );
87 #define ReturnIfInvalid( nullable ) if( !nullable.IsValid ) return std::move( nullable.ErrorString );
Nullable(std::string &&error)
Creates invalid object and sets error string. Value fieled is default contructed. ...
Definition: Nullable.h:41
Returns value or error.
Definition: Nullable.h:19
Nullable(NullableInit)
Creates valid object. Value fieled is default contructed.
Definition: Nullable.h:35
Nullable()
Creates invalid object. Value fieled is default contructed.
Definition: Nullable.h:28
Nullable(ResultType &&result)
Creates valid object.
Definition: Nullable.h:48