ADBC
Arrow Database Connectivity
Loading...
Searching...
No Matches
adbc::driver::Result< T > Class Template Reference

A wrapper around a value, or an error. More...

#include <status.h>

Public Member Functions

 Result (Status s)
 Implicit constructor to allow returning a status in functions.
 
template<typename U , typename E = typename std::enable_if< std::is_constructible<T, U>::value && std::is_convertible<U, T>::value && !std::is_same<typename std::remove_reference< typename std::remove_cv<U>::type>::type, Status>::value>::type>
 Result (U &&t)
 Implicit constructor to allow returning a value in functions.
 
bool has_value () const
 Check if this has a value or not.
 
const Statusstatus () const &
 Get the status (if present).
 
Status && status () &&
 Move the status (if present).
 
T & value ()
 Get the value (if present).
 

Private Attributes

std::variant< Status, T > value_
 

Detailed Description

template<typename T>
class adbc::driver::Result< T >

A wrapper around a value, or an error.

We could probably do better by using a library like std::expected, but this will suffice for now. There doesn't seem to be a reasonably maintained std::expected backport.

Constructor & Destructor Documentation

◆ Result() [1/2]

template<typename T >
adbc::driver::Result< T >::Result ( Status s)
inline

Implicit constructor to allow returning a status in functions.

◆ Result() [2/2]

template<typename T >
template<typename U , typename E = typename std::enable_if< std::is_constructible<T, U>::value && std::is_convertible<U, T>::value && !std::is_same<typename std::remove_reference< typename std::remove_cv<U>::type>::type, Status>::value>::type>
adbc::driver::Result< T >::Result ( U && t)
inline

Implicit constructor to allow returning a value in functions.

Member Function Documentation

◆ has_value()

template<typename T >
bool adbc::driver::Result< T >::has_value ( ) const
inline

Check if this has a value or not.

◆ status() [1/2]

template<typename T >
Status && adbc::driver::Result< T >::status ( ) &&
inline

Move the status (if present).

◆ status() [2/2]

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

Get the status (if present).

◆ value()

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

Get the value (if present).


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