COPP C++ API
C++ interface for COPP trajectory optimization
Loading...
Searching...
No Matches
copp::Expected< T > Class Template Reference

Small C++17 expected-like result used by no-throw overloads. More...

#include <core.hpp>

Public Member Functions

 Expected (T value)
bool has_value () const noexcept
 operator bool () const noexcept
T & value () &
const T & value () const &
T && value () &&
const ErrorInfoerror () const noexcept

Static Public Member Functions

static Expected failure (Status status, std::string message)

Detailed Description

template<typename T>
class copp::Expected< T >

Small C++17 expected-like result used by no-throw overloads.

The throwing API remains the primary surface. No-throw overloads take copp::no_throw as their final argument and return Expected<T>. They are implemented by catching exceptions from the normal API, so this is not a -fno-exceptions build mode.

auto result = copp::Path::from_waypoints({{0.0}, {1.0}}, copp::no_throw);
if (!result) {
std::cerr << result.error().message << "\n";
return;
}
auto path = std::move(result).value();
static Path from_waypoints(MatrixView waypoints, SplineConfig config={})
Build a spline path from waypoint positions.
constexpr NoThrowTag no_throw
Definition core.hpp:612
Template Parameters
TSuccessful return type.

Definition at line 526 of file core.hpp.

Constructor & Destructor Documentation

◆ Expected()

template<typename T>
copp::Expected< T >::Expected ( T value)
inline

Definition at line 529 of file core.hpp.

Member Function Documentation

◆ failure()

template<typename T>
Expected copp::Expected< T >::failure ( Status status,
std::string message )
inlinestatic

Definition at line 531 of file core.hpp.

◆ has_value()

template<typename T>
bool copp::Expected< T >::has_value ( ) const
inlinenoexcept

Definition at line 538 of file core.hpp.

◆ operator bool()

template<typename T>
copp::Expected< T >::operator bool ( ) const
inlineexplicitnoexcept

Definition at line 539 of file core.hpp.

◆ value() [1/3]

template<typename T>
T & copp::Expected< T >::value ( ) &
inline

Definition at line 541 of file core.hpp.

◆ value() [2/3]

template<typename T>
const T & copp::Expected< T >::value ( ) const &
inline

Definition at line 550 of file core.hpp.

◆ value() [3/3]

template<typename T>
T && copp::Expected< T >::value ( ) &&
inline

Definition at line 559 of file core.hpp.

◆ error()

template<typename T>
const ErrorInfo & copp::Expected< T >::error ( ) const
inlinenoexcept

Definition at line 568 of file core.hpp.


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