FastLED 3.9.15
Loading...
Searching...
No Matches
fl::expected< void, E > Class Template Reference

Detailed Description

template<typename E>
class fl::expected< void, E >

Specialization for void (no value to return)

Uses fl::variant<VoidSuccess, ErrorInfo<E>> for consistent implementation

Template Parameters
EThe type of the error code (must be an enum or integral type)

Definition at line 148 of file expected.h.

#include <expected.h>

+ Inheritance diagram for fl::expected< void, E >:
+ Collaboration diagram for fl::expected< void, E >:

Public Member Functions

 expected () FL_NOEXCEPT
 Default constructor (creates error state)
 
 expected () FL_NOEXCEPT
 Default constructor (creates error state)
 
 expected (const expected &other) FL_NOEXCEPT
 Copy constructor (needed for some use cases like Impl initialization)
 
 expected (expected &&other) FL_NOEXCEPT=default
 Move constructor (defaulted - variant handles it)
 
 expected (expected &&other) FL_NOEXCEPT=default
 Move constructor (defaulted - variant handles it)
 
 ~expected () FL_NOEXCEPT=default
 Destructor (defaulted - variant handles cleanup)
 
 ~expected () FL_NOEXCEPT=default
 Destructor (defaulted - variant handles cleanup)
 
error () const FL_NOEXCEPT
 Get error code (only meaningful if !ok())
 
error () const FL_NOEXCEPT
 
bool has_value () const FL_NOEXCEPT
 Check if operation succeeded (alias for ok())
 
const char * message () const FL_NOEXCEPT
 Get error message (only meaningful if !ok())
 
const char * message () const FL_NOEXCEPT
 
bool ok () const FL_NOEXCEPT
 Check if operation succeeded.
 
bool ok () const FL_NOEXCEPT
 
 operator bool () const FL_NOEXCEPT
 Explicit conversion to bool for contextual evaluation.
 
 operator bool () const FL_NOEXCEPT
 
expectedoperator= (const expected &other) FL_NOEXCEPT
 Copy assignment.
 
expectedoperator= (expected &&other) FL_NOEXCEPT=default
 Move assignment (defaulted - variant handles it)
 
expectedoperator= (expected &&other) FL_NOEXCEPT=default
 Move assignment (defaulted - variant handles it)
 
const void & value () const FL_NOEXCEPT
 
void & value () FL_NOEXCEPT
 Get value (only valid if ok() == true)
 

Static Public Member Functions

static expected failure (E err, const char *msg=nullptr) FL_NOEXCEPT
 Create error result.
 
static expected failure (E err, const char *msg=nullptr) FL_NOEXCEPT
 
static expected success () FL_NOEXCEPT
 
static expected success (void value) FL_NOEXCEPT
 Create successful result.
 

Private Member Functions

 expected (const expected &) FL_NOEXCEPT=delete
 
expectedoperator= (const expected &) FL_NOEXCEPT=delete
 

Private Attributes

fl::variant< void, ErrorInfo< E > > mData
 
fl::variant< VoidSuccess, ErrorInfo< E > > mData
 

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