util::AnyPtr

Helper function to access the contained object of a std::any instance. Returns a pointer to the object if passed instance has a value and the type matches, nullptr otherwise.

Synopsis

Declared in <util/any.h>

template<typename T>
T*
AnyPtr(std::any const& any) noexcept;

Return Value

A pointer to the contained T*, or nullptr when empty or of a different type.

Parameters

NameDescription
anyThe std::any instance to inspect.