![]() |
algotradelib 0.0.0.9000
C++ header-only library for algorithmic trading
|
Either a value or a BrokerError. More...
#include <algotradelib/src/core/types.hpp>
Public Member Functions | |
| Result (T value) | |
| Constructs a successful result. | |
| Result (BrokerError error) | |
| Constructs a failed result. | |
| bool | has_value () const noexcept |
| Tests whether the result holds a value. | |
| operator bool () const noexcept | |
| Tests whether the result holds a value. | |
| T & | value () |
| Returns the value. | |
| const T & | value () const |
| Returns the value. | |
| BrokerError & | error () |
| Returns the error. | |
| const BrokerError & | error () const |
| Returns the error. | |
Either a value or a BrokerError.
Test it with has_value() (or if (result)) before calling value() or error(); the wrong accessor throws std::bad_variant_access.
| T | The value type. |
|
inline |
Constructs a successful result.
| value | The value. |
Definition at line 803 of file types.hpp.
Referenced by algotradelib::BlockingSession< Client >::bars(), algotradelib::BlockingSession< Client >::calendar(), algotradelib::BlockingSession< Client >::cancel(), algotradelib::DataOnlyTraits< Tag >::cancel_order(), algotradelib::backtest::CommissionPolicy::charge(), algotradelib::backtest::commission_model_from(), algotradelib::DataOnlyTraits< Tag >::holdings(), algotradelib::BlockingSession< Client >::order_history(), algotradelib::DataOnlyTraits< Tag >::order_history(), algotradelib::BlockingSession< Client >::place(), algotradelib::DataOnlyTraits< Tag >::place_order(), algotradelib::data_only::post_refusal(), algotradelib::BlockingSession< Client >::replace(), algotradelib::DataOnlyTraits< Tag >::replace_order(), algotradelib::backtest::CommissionPolicy::scheduled(), algotradelib::DataOnlyTraits< Tag >::to_cancellation(), algotradelib::DataOnlyTraits< Tag >::to_history_query(), and algotradelib::DataOnlyTraits< Tag >::to_replacement().
|
inline |
|
inline |
Returns the error.
| std::bad_variant_access | if the result holds a value. |
Definition at line 842 of file types.hpp.
Referenced by algotradelib::DataOnlyTraits< Tag >::normalize_place(), and Result().
|
inline |
|
inlinenoexcept |
Tests whether the result holds a value.
Definition at line 815 of file types.hpp.
Referenced by operator bool().
|
inlineexplicitnoexcept |
|
inline |
|
inline |