forpy 2

Public Types | List of all members
forpy::ptr_variant< Ts > Struct Template Reference

`#include <storage.h>`

Inheritance diagram for forpy::ptr_variant< Ts >:

## Public Types
using | Base = mu::variant< Ts... >

## Detailed Description

### template<typename... Ts>
struct forpy::ptr_variant< Ts >

Design concepts behind this storage.

Aims are:

- easy and serializable storage for internal types,
- encoding of multiple possible return types,
- high efficiency,
- no hassle for library users,
- remain as compatible with the standard as possible (c.f., std::variant in C++ 17).

Since it should be possible to use this library with large datasets that shouldn't have to be copied when library functions are called, this implies some additional constraints.

The standard says that std::variant can't hold pointer types, which is necessary for this to work. The currently provided mu::variant can do this.

To not influence library user experience and not create problems when feeding the library with data, all external methods accept either std::shared_ptr<Eigen::Mat>s if ownership of the data must be set. That's why the `store` suffixed variants contain shared_ptr's (otherwise the data would have to be copied).

In all other cases, the variants contain the data or MatRefs to it directly for internal library use.

The ptr_variant is a subclass of the variant for which an automatic return type conversion to Python is applied. `Empty` is similar to `std::monostate`. The VReset visitor can be used to clear `ptr_variant`s.

Definition at line 55 of file storage.h.

## Member Typedef Documentation

## ◆ Base

template<typename... Ts>

using forpy::ptr_variant< Ts >::Base = mu::variant<Ts...>

Definition at line 56 of file storage.h.

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

- /Users/classner/git/forpy/include/forpy/util/storage.h