LIEF: Library to Instrument Executable Formats Version 1.0.0
Loading...
Searching...
No Matches
LIEF::result< T > Class Template Reference

Wrapper that contains an Object (T) or an error. More...

#include <errors.hpp>

Inheritance diagram for LIEF::result< T >:
Collaboration diagram for LIEF::result< T >:

Additional Inherited Members

Public Types inherited from tl::expected< T, lief_errors >
typedef T value_type
typedef lief_errors error_type
typedef unexpected< lief_errorsunexpected_type
Public Member Functions inherited from tl::expected< T, lief_errors >
constexpr auto and_then (F &&f) &-> decltype(and_then_impl(std::declval< expected & >(), std::forward< F >(f)))
constexpr decltype(expected_map_impl(std::declval< expected & >(), std::declval< F && >())) map (F &&f) &
constexpr decltype(expected_map_impl(std::declval< expected & >(), std::declval< F && >())) transform (F &&f) &
constexpr decltype(map_error_impl(std::declval< expected & >(), std::declval< F && >())) map_error (F &&f) &
constexpr decltype(map_error_impl(std::declval< expected & >(), std::declval< F && >())) transform_error (F &&f) &
expected constexpr or_else (F &&f) &
constexpr expected ()=default
expectedoperator= (const expected &rhs)=default
void emplace (Args &&...args)
detail::enable_if_t< detail::is_swappable< OT >::value &&detail::is_swappable< OE >::value &&(std::is_nothrow_move_constructible< OT >::value||std::is_nothrow_move_constructible< OE >::value)> swap (expected &rhs) noexcept(std::is_nothrow_move_constructible< T >::value &&detail::is_nothrow_swappable< T >::value &&std::is_nothrow_move_constructible< lief_errors >::value &&detail::is_nothrow_swappable< lief_errors >::value)
constexpr const T * operator-> () const
constexpr const U & operator* () const &
constexpr bool has_value () const noexcept
constexpr operator bool () const noexcept
constexpr const U & value () const &
constexpr const lief_errorserror () const &
constexpr T value_or (U &&v) const &

Detailed Description

template<typename T>
class LIEF::result< T >

Wrapper that contains an Object (T) or an error.

The tl/expected implementation exposes the method value() to access the underlying object (if no error)

Typical usage is:

result<int> intval = my_function();
if (intval) {
int val = intval.value();
} else { // There is an error
std::cout << get_error(intval).message() << "\n";
}
Wrapper that contains an Object (T) or an error.
Definition errors.hpp:77
constexpr const U & value() const &
Definition expected.hpp:2017
lief_errors get_error(result< T > &err)
Get the error code associated with the result.
Definition errors.hpp:84

See https://tl.tartanllama.xyz/en/latest/api/expected.html for more details


The documentation for this class was generated from the following file: