Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
20 lines (12 sloc) 556 Bytes


Source code

A handful of handy casts.

.. function:: template <class To, class From> To tl::bit_cast (From const& from)

    Casts the bit representation of `from` to a `To`. Use this instead of type punning
    through a union or `reinterpret_cast`. Essentially does: ::

        To to;
        std::memcpy(&to, &from, sizeof(to));

.. function:: template <class E> auto underlying_cast (E e)

    Casts an enumerator value to its underlying type.

You can’t perform that action at this time.