#ifndef BOOST_TYPE_TRAITS_DETAIL_COMMON_TYPE_IMPL_HPP_INCLUDED #define BOOST_TYPE_TRAITS_DETAIL_COMMON_TYPE_IMPL_HPP_INCLUDED // // Copyright 2015 Peter Dimov // // 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 // #include #include #include #include #include #include #include #include #include #include namespace boost { namespace type_traits_detail { // the arguments to common_type_impl have already been passed through decay<> template struct common_type_impl; // same type template struct common_type_impl { typedef T type; }; // one of the operands is a class type, try conversions in both directions template struct ct_class { BOOST_STATIC_CONSTANT( bool, ct = boost::is_class::value || boost::is_union::value ); BOOST_STATIC_CONSTANT( bool, cu = boost::is_class::value || boost::is_union::value ); BOOST_STATIC_CONSTANT( bool, value = ct || cu ); }; template struct common_type_impl3; template struct common_type_class: public boost::conditional< boost::is_convertible::value && !boost::is_convertible::value, boost::type_identity, typename boost::conditional< boost::is_convertible::value && !boost::is_convertible::value, boost::type_identity, common_type_impl3 >::type >::type { }; template struct common_type_impl: public boost::conditional< ct_class::value, common_type_class, common_type_impl3 >::type { }; // pointers template struct common_type_impl4; template struct common_type_impl3: public boost::conditional< boost::is_pointer::value || boost::is_pointer::value, composite_pointer_type, common_type_impl4 >::type { }; // pointers to members template struct common_type_impl5; template struct common_type_impl4: public boost::conditional< boost::is_member_pointer::value || boost::is_member_pointer::value, composite_member_pointer_type, common_type_impl5 >::type { }; // arithmetic types (including class types w/ conversions to arithmetic and enums) template struct common_type_impl5: public common_arithmetic_type { }; } // namespace type_traits_detail } // namespace boost #endif // #ifndef BOOST_TYPE_TRAITS_DETAIL_COMMON_TYPE_IMPL_HPP_INCLUDED