Lightgraph
C++17 light-graph engine API reference
Loading...
Searching...
No Matches
lightgraph::Result< T > Class Template Reference

#include <status.hpp>

Public Member Functions

 Result (T value, Status status=Status::success())
 
bool ok () const
 True when result status is success.
 
 operator bool () const
 
const Tvalue () const
 Access the contained value.
 
Tvalue ()
 
const Statusstatus () const
 Access the operation status.
 

Static Public Member Functions

static Result< Terror (ErrorCode code, std::string message)
 Construct an error result.
 

Detailed Description

template<typename T>
class lightgraph::Result< T >

Definition at line 70 of file status.hpp.

Constructor & Destructor Documentation

◆ Result()

template<typename T >
lightgraph::Result< T >::Result ( T  value,
Status  status = Status::success() 
)
inline

Definition at line 72 of file status.hpp.

Member Function Documentation

◆ error()

template<typename T >
static Result< T > lightgraph::Result< T >::error ( ErrorCode  code,
std::string  message 
)
inlinestatic

Construct an error result.

The value is default-constructed and should be ignored when ok() is false.

Definition at line 80 of file status.hpp.

References lightgraph::Status::error().

◆ ok()

template<typename T >
bool lightgraph::Result< T >::ok ( ) const
inline

True when result status is success.

Definition at line 87 of file status.hpp.

References lightgraph::Status::ok().

Referenced by lightgraph::Result< T >::operator bool().

◆ operator bool()

template<typename T >
lightgraph::Result< T >::operator bool ( ) const
inlineexplicit

Definition at line 89 of file status.hpp.

References lightgraph::Result< T >::ok().

◆ status()

template<typename T >
const Status & lightgraph::Result< T >::status ( ) const
inline

Access the operation status.

Definition at line 103 of file status.hpp.

◆ value() [1/2]

template<typename T >
T & lightgraph::Result< T >::value ( )
inline

Definition at line 98 of file status.hpp.

◆ value() [2/2]

template<typename T >
const T & lightgraph::Result< T >::value ( ) const
inline

Access the contained value.

Callers should only use this when ok() is true.

Definition at line 96 of file status.hpp.


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