23#ifndef ELEMENTSKERNEL_ELEMENTSKERNEL_FUNCPTRCAST_IMPL_
24#error "This file should not be included directly! Use ElementsKernel/FuncPtrCast.h instead"
34template <
typename DESTPTR,
typename SRC>
35constexpr DESTPTR
FuncPtrCast(SRC*
const src_p)
noexcept {
36 static_assert(std::is_pointer<DESTPTR>::value,
"must be a pointer");
37 DESTPTR dst_p =
nullptr;
38 std::memcpy(&dst_p, &src_p,
sizeof(dst_p));
constexpr DESTPTR FuncPtrCast(SRC *const src_p) noexcept
Cast from void * to function pointer.