File indexing completed on 2025-01-18 09:52:31
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef BOOST_STACKTRACE_DETAIL_VOID_PTR_CAST_HPP
0009 #define BOOST_STACKTRACE_DETAIL_VOID_PTR_CAST_HPP
0010
0011 #include <boost/config.hpp>
0012 #ifdef BOOST_HAS_PRAGMA_ONCE
0013 # pragma once
0014 #endif
0015
0016 #include <type_traits>
0017
0018 #if defined(__GNUC__) && defined(__GNUC_MINOR__) && (__GNUC__ * 100 + __GNUC_MINOR__ > 301)
0019 # pragma GCC system_header
0020 #endif
0021
0022 namespace boost { namespace stacktrace { namespace detail {
0023
0024
0025
0026 template <class To, class From>
0027 To void_ptr_cast(From* v) noexcept {
0028 static_assert(
0029 std::is_pointer<To>::value,
0030 "`void_ptr_cast` function must be used only for casting to or from void pointers."
0031 );
0032
0033 static_assert(
0034 sizeof(From*) == sizeof(To),
0035 "Pointer to function and pointer to object differ in size on your platform."
0036 );
0037
0038 return reinterpret_cast<To>(v);
0039 }
0040
0041
0042 }}}
0043
0044 #endif
0045