Utility wrappers and containers

class unique_any

A container for a single value of any type that is move constructable. Used in the Arbor API where a type of a value passed to or from the API is decided at run time.

class any_ptr

Holds a pointer to an arbitrary type, together with the type information.

template<typename T>
T as()

Retrieve the pointer as type T. If T is void * or the same as the type of the pointer stored in any_ptr, return the held value, cast accordingly. Otherwise return nullptr.

any_ptr can be used with util::any_cast, so that util::any_cast<T>(p) is equivalent to p.as<T>() for a value p of type any_ptr.

template<typename T>
any_cast(...)

Equivalent to std::any_cast for std::any arguments, any_cast also performs analogous casting for the unique_any and any_ptr utility classes.

See Cable cells.