ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Acts::Result< void, E > Class Template Reference

#include <acts/blob/master/Core/include/Acts/Utilities/Result.hpp>

Public Member Functions

 Result ()=default
 
 Result (const Result< void, E > &other)=default
 
Result< void, E > & operator= (const Result< void, E > &other)=default
 
 Result (Result< void, E > &&other)
 
Result< void, E > & operator= (Result< void, E > &&other) noexcept
 
template<typename E2 >
 Result (E2 error) noexcept
 
template<typename E2 >
Result< void, E > & operator= (E2 error)
 
bool ok () const noexcept
 
Eerror ()&noexcept
 
E error ()&&noexcept
 

Static Public Member Functions

static Result< void, Esuccess ()
 
static Result< void, Efailure (E error)
 

Private Attributes

std::optional< Em_opt
 

Detailed Description

template<typename E>
class Acts::Result< void, E >

Template specialization for the void case. This specialization handles the case where there is no actual return value, but an error might be returned. Returning the error directly would make handling different from other functions using the Result<T, E> mechanism. Result<void, E> does not have the dereference operator, and value methods. The static success factory does not accept a value.

Note
To ease usage, this Result<void, E> is default constructible in the ok state, whereas Result<T, E> is not.
Template Parameters
EThe type of the error

Definition at line 219 of file Result.hpp.

View newest version in sPHENIX GitHub at line 219 of file Result.hpp

Constructor & Destructor Documentation

template<typename E >
Acts::Result< void, E >::Result ( )
default

Default constructor which initializes the result in the ok state.

template<typename E >
Acts::Result< void, E >::Result ( const Result< void, E > &  other)
default

The copy constructor is deleted.

template<typename E >
Acts::Result< void, E >::Result ( Result< void, E > &&  other)
inline

Move constructor

Parameters
otherThe other result object, rvalue ref

Definition at line 240 of file Result.hpp.

View newest version in sPHENIX GitHub at line 240 of file Result.hpp

template<typename E >
template<typename E2 >
Acts::Result< void, E >::Result ( E2  error)
inlinenoexcept

Constructor from error. This implicitly requires E2 to be convertible to E.

Template Parameters
E2The type of the actual error
Parameters
errorThe instance of the actual error

Definition at line 257 of file Result.hpp.

View newest version in sPHENIX GitHub at line 257 of file Result.hpp

Member Function Documentation

template<typename E >
E& Acts::Result< void, E >::error ( )
inlinenoexcept

Returns a reference to the error stored in the result.

Note
If res.ok() this method will abort (noexcept)
Returns
Reference to the error

Definition at line 297 of file Result.hpp.

View newest version in sPHENIX GitHub at line 297 of file Result.hpp

template<typename E >
E Acts::Result< void, E >::error ( )
inlinenoexcept

Returns the error by-value.

Note
If res.ok() this method will abort (noexcept)
Returns
Reference to the error

Definition at line 304 of file Result.hpp.

View newest version in sPHENIX GitHub at line 304 of file Result.hpp

template<typename E >
static Result<void, E> Acts::Result< void, E >::failure ( E  error)
inlinestatic

Static factory function to initialize the result in the error state.

Parameters
errorThe errorr to initialize with.
Returns
Result object, in error state.

Definition at line 282 of file Result.hpp.

View newest version in sPHENIX GitHub at line 282 of file Result.hpp

template<typename E >
bool Acts::Result< void, E >::ok ( ) const
inlinenoexcept

Checks whether this result is in the ok state, and no error.

Returns
bool Whether result contains an error or not.

Definition at line 290 of file Result.hpp.

View newest version in sPHENIX GitHub at line 290 of file Result.hpp

template<typename E >
Result<void, E>& Acts::Result< void, E >::operator= ( const Result< void, E > &  other)
default

The (self) assignment operator is deleted.

template<typename E >
Result<void, E>& Acts::Result< void, E >::operator= ( Result< void, E > &&  other)
inlinenoexcept

Move assignment operator

Parameters
otherThe other result object, rvalue ref

Definition at line 246 of file Result.hpp.

View newest version in sPHENIX GitHub at line 246 of file Result.hpp

References m_opt.

template<typename E >
template<typename E2 >
Result<void, E>& Acts::Result< void, E >::operator= ( E2  error)
inline

Assignment operator from an error.

Template Parameters
E2The type of the actual error
Parameters
errorThe instance of the actual error
Returns
The assigned instance

Definition at line 266 of file Result.hpp.

View newest version in sPHENIX GitHub at line 266 of file Result.hpp

template<typename E >
static Result<void, E> Acts::Result< void, E >::success ( )
inlinestatic

Static factory function to initialize the result in the ok state.

Returns
Result object, in ok state

Definition at line 275 of file Result.hpp.

View newest version in sPHENIX GitHub at line 275 of file Result.hpp

Member Data Documentation

template<typename E >
std::optional<E> Acts::Result< void, E >::m_opt
private

Definition at line 307 of file Result.hpp.

View newest version in sPHENIX GitHub at line 307 of file Result.hpp

Referenced by operator=().


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