/*============================================================================= Copyright (c) 2011-2015 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< (sprout::is_reference::value && sprout::is_same::type, typename sprout::decay::type>::value && sprout::is_convertible::value ) || ((sprout::is_integral::type || sprout::is_enum::type || sprout::is_pointer::type) && sprout::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