Struct Any

Struct Documentation

struct Any

Minimal std::any replacement, works pre c++17

Public Functions

inline Any(const void *_ptr, const size_t _length, const std::type_index &_type, const unsigned int _elements)

Constructor

Note

Copies the data

Parameters:
  • _ptr – Pointer to data to represent

  • _length – Length of pointed to data

  • _type – Identifier of type

  • _elements – How many elements does the property have (1 if it’s not an array)

template<typename T>
inline explicit Any(const T other)
inline Any(const Any &_other)

Copy constructor

Parameters:

_other – Other Any to be cloned, makes a copy of the pointed to data

inline ~Any()
void operator=(const Any &_other) = delete

Can’t assign, members are const at creation

inline bool operator==(const Any &rhs) const

Public Members

void *const ptr

Data represented by this object

const size_t length

Length of memory allocation pointed to by ptr

const std::type_index type

Type index to unwrap the value

const unsigned int elements

Number of elements (1 if not array)