Class Generic

Nested Relationships

Nested Types

Inheritance Relationships

Derived Type

Class Documentation

class Generic

A type-erasing wrapper class a la “Runtime Polymorphism” by Sean Parent et al.

Subclassed by ouster::sdk::core::FrameSetSourceMetadata

Public Functions

virtual ~Generic() = default
template<typename T>
inline Generic(T value)

Construct a Generic object from any type T.

Parameters:

value[in] The value to store in the Generic object.

template<typename T>
inline bool is() const

Check if the Generic object holds a value of type T.

Template Parameters:

T – The type to check for.

Returns:

True if the Generic object holds a value of type T, false otherwise.

template<typename T>
inline const T &as() const

Get the value stored in the Generic object as type T.

Template Parameters:

T – The type to get the value as.

Throws:

std::bad_cast – if the Generic object does not hold a value of type T.

Returns:

The value stored in the Generic object as type T.