Function to_address

Synopsis

#include <src/entt/core/memory.hpp>

template <typename Type>
constexpr auto to_address(Type &&ptr)

Description

Unwraps fancy pointers, does nothing otherwise (waiting for C++20).

Template Parameters

Type - Pointer type.

Parameters

ptr - Fancy or raw pointer.

Returns
A raw pointer that represents the address of the original pointer.

Source

Lines 19-26 in src/entt/core/memory.hpp.

template<typename Type>
[[nodiscard]] constexpr auto to_address(Type &&ptr) ENTT_NOEXCEPT {
    if constexpr(std::is_pointer_v<std::remove_const_t<std::remove_reference_t<Type>>>) {
        return ptr;
    } else {
        return to_address(std::forward<Type>(ptr).operator->());
    }
}





Add Discussion

Log in to comment