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 >:

Public Types

using ExpectedType = T

Public Member Functions

 result (tl::expected< T, lief_errors > e)

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";
}
result(tl::expected< T, lief_errors > e)
Definition errors.hpp:81
lief_errors get_error(result< T > &err)
Get the error code associated with the result.
Definition errors.hpp:87

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

Member Typedef Documentation

◆ ExpectedType

template<typename T>
using LIEF::result< T >::ExpectedType = T

Constructor & Destructor Documentation

◆ result()

template<typename T>
LIEF::result< T >::result ( tl::expected< T, lief_errors > e)
inline

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