Implementation of the C++23 expected class which can contain an error or a success value.
More...
|
| | expected ()=delete |
| | default ctor is deleted since you have to clearly state if the expected contains a success value or an error value
|
| |
| | expected (const expected &) noexcept=default |
| | the copy constructor calls the copy constructor of the contained success value or the error value - depending on what is stored in the expected
|
| |
| | expected (expected &&rhs) noexcept |
| | the move constructor calls the move constructor of the contained success value or the error value - depending on what is stored in the expected
|
| |
| template<typename... Targs> |
| | expected (in_place_t, Targs &&... args) noexcept |
| | Creates an expected which is signaling success and perfectly forwards the args to the constructor of ValueType.
|
| |
| template<typename... Targs> |
| | expected (unexpect_t, Targs &&... args) noexcept |
| | Creates an expected which is signaling an error and perfectly forwards the args to the constructor of ErrorType.
|
| |
| | ~expected () noexcept=default |
| | calls the destructor of the success value or error value - depending on what is stored in the expected
|
| |
| expected & | operator= (const expected &) noexcept |
| | calls the copy assignment operator of the contained success value or the error value - depending on what is stored in the expected
|
| |
| expected & | operator= (expected &&rhs) noexcept |
| | calls the move assignment operator of the contained success value or the error value - depending on what is stored in the expected
|
| |
| | expected (const detail::ok< ValueType > &successValue) noexcept |
| | constructs an expected which is signaling success and uses the value provided by successValue to copy construct its success value
|
| |
| | expected (detail::ok< ValueType > &&successValue) noexcept |
| | constructs an expected which is signaling success and uses the value provided by successValue to move construct its success value
|
| |
| | expected (const detail::err< ErrorType > &errorValue) noexcept |
| | constructs an expected which is signaling an error and stores the error value provided by errorValue
|
| |
| | expected (detail::err< ErrorType > &&errorValue) noexcept |
| | constructs an expected which is signaling an error and stores the error value provided by errorValue
|
| |
| | operator bool () const noexcept |
| | returns true if the expected contains a value type and false if it is an error type
|
| |
| bool | has_value () const noexcept |
| | returns true if the expected contains a value type and false if it is an error type
|
| |
| bool | has_error () const noexcept |
| | returns true if the expected contains an error otherwise false
|
| |
| ErrorType & | error (bb::detail::SourceLocation location=bb::detail::SourceLocation::current()) &noexcept |
| | returns a lvalue reference to the contained error value, if the expected does not contain an error the error handler is called
|
| |
| const ErrorType & | error (bb::detail::SourceLocation location=bb::detail::SourceLocation::current()) const &noexcept |
| | returns a const lvalue reference to the contained error value, if the expected does not contain an error the error handler is called
|
| |
| ErrorType && | error (bb::detail::SourceLocation location=bb::detail::SourceLocation::current()) &&noexcept |
| | returns a rvalue reference to the contained error value, if the expected does not contain an error the error handler is called
|
| |
| const ErrorType && | error (bb::detail::SourceLocation location=bb::detail::SourceLocation::current()) const &&noexcept |
| | returns a const rvalue reference to the contained error value, if the expected does not contain an error the error handler is called
|
| |
| template<typename U = ValueType> |
| enable_if_non_void_t< U > & | value (bb::detail::SourceLocation location=bb::detail::SourceLocation::current()) &noexcept |
| | returns a lvalue reference to the contained success value, if the expected does not contain a success value the error handler is called
|
| |
| template<typename U = ValueType> |
| const enable_if_non_void_t< U > & | value (bb::detail::SourceLocation location=bb::detail::SourceLocation::current()) const &noexcept |
| | returns a const lvalue reference to the contained success value, if the expected does not contain a success value the error handler is called
|
| |
| template<typename U = ValueType> |
| enable_if_non_void_t< U > && | value (bb::detail::SourceLocation location=bb::detail::SourceLocation::current()) &&noexcept |
| | returns a rvalue reference to the contained success value, if the expected does not contain a success value the error handler is called
|
| |
| template<typename U = ValueType> |
| const enable_if_non_void_t< U > && | value (bb::detail::SourceLocation location=bb::detail::SourceLocation::current()) const &&noexcept |
| | returns a const rvalue reference to the contained success value, if the expected does not contain a success value the error handler is called
|
| |
| template<typename U = ValueType> |
| enable_if_non_void_t< U > & | operator* () noexcept |
| | dereferencing operator which returns a reference to the contained success value. if the expected contains an error the error handler is called
|
| |
| template<typename U = ValueType> |
| const enable_if_non_void_t< U > & | operator* () const noexcept |
| | dereferencing operator which returns a reference to the contained success value. if the expected contains an error the error handler is called
|
| |
| template<typename U = ValueType> |
| enable_if_non_void_t< U > * | operator-> () noexcept |
| | arrow operator which returns the pointer to the contained success value if the expected contains an error the error handler is called
|
| |
| template<typename U = ValueType> |
| const enable_if_non_void_t< U > * | operator-> () const noexcept |
| | arrow operator which returns the pointer to the contained success value if the expected contains an error the the error handler is called
|
| |
| | operator expected< void, ErrorType > () const noexcept |
| | conversion operator to a 'void' value type expected which can be useful if you would like to return only the success of a function
|
| |
Implementation of the C++23 expected class which can contain an error or a success value.
- Parameters
-
| ValueType | type of the value which can be stored in the expected |
| ErrorType | type of the error which can be stored in the expected |
Definition at line 150 of file expected.hpp.