/*============================================================================= Copyright (c) 2011-2019 Bolero MURAKAMI https://github.com/bolero-MURAKAMI/Sprout Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) =============================================================================*/ #ifndef SPROUT_UTILITY_REINTER_CAST_HPP #define SPROUT_UTILITY_REINTER_CAST_HPP #include #include #include #include #include namespace sprout { namespace detail { template struct is_same_reinterpret_cast : public sprout::bool_constant< (std::is_reference::value && std::is_same::type, typename std::decay::type>::value && std::is_convertible::value ) || ((std::is_integral::type || std::is_enum::type || std::is_pointer::type) && std::is_same::type, To>::value ) > {}; } // namespace detail // // reinter_cast // template< typename T, typename U, typename sprout::enabler_if::value>::type = sprout::enabler > inline SPROUT_CONSTEXPR T reinter_cast(U&& x) { return SPROUT_FORWARD(U, x); } template< typename T, typename U, typename sprout::enabler_if::value>::type = sprout::enabler > inline SPROUT_NON_CONSTEXPR T reinter_cast(U&& x) { return reinterpret_cast(SPROUT_FORWARD(U, x)); } } // namespace sprout #endif // #ifndef SPROUT_UTILITY_REINTER_CAST_HPP