.. _libref: Utility wrappers and containers =============================== .. cpp:namespace:: arb::util .. cpp:class:: unique_any A container for a single value of any type that is move constructible. Used in the Arbor API where a type of a value passed to or from the API is decided at run time. .. cpp:class:: any_ptr Holds a pointer to an arbitrary type, together with the type information. .. cpp:function:: template 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 and cast accordingly. Otherwise, return ``nullptr``. ``any_ptr`` can be used with ``util::any_cast``, so that ``util::any_cast(p)`` is equivalent to ``p.as()`` for a value ``p`` of type ``any_ptr``. .. cpp:function:: template any_cast(...) Equivalent to ``std::any_cast`` for ``std::any`` arguments, ``any_cast`` also performs analogous casting for the :cpp:class:`unique_any` and :cpp:class:`any_ptr` utility classes. See :ref:`cppcablecell`.