// (C) Copyright John Maddock 2017. // Use, modification and distribution are subject to 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). // // See http://www.boost.org/libs/type_traits for most recent version including documentation. #ifndef BOOST_TT_IS_COMPLETE_HPP_INCLUDED #define BOOST_TT_IS_COMPLETE_HPP_INCLUDED #include #include #include #include #include #include /* * CAUTION: * ~~~~~~~~ * * THIS TRAIT EXISTS SOLELY TO GENERATE HARD ERRORS WHEN A ANOTHER TRAIT * WHICH REQUIRES COMPLETE TYPES AS ARGUMENTS IS PASSED AN INCOMPLETE TYPE * * DO NOT MAKE GENERAL USE OF THIS TRAIT, AS THE COMPLETENESS OF A TYPE * VARIES ACROSS TRANSLATION UNITS AS WELL AS WITHIN A SINGLE UNIT. * */ namespace boost { // // We will undef this if the trait isn't fully functional: // #define BOOST_TT_HAS_WORKING_IS_COMPLETE #if !defined(BOOST_NO_SFINAE_EXPR) && !BOOST_WORKAROUND(BOOST_MSVC, <= 1900) && !BOOST_WORKAROUND(BOOST_GCC_VERSION, < 40600) namespace detail{ template struct ok_tag { double d; char c[N]; }; template ok_tag check_is_complete(int); template char check_is_complete(...); } template struct is_complete : public integral_constant::type>::value || (sizeof(detail::check_is_complete(0)) != sizeof(char))> {}; #elif !defined(BOOST_NO_SFINAE) && !defined(BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS) && !BOOST_WORKAROUND(BOOST_GCC_VERSION, < 40500) namespace detail { template struct is_complete_imp { template ())) > static type_traits::yes_type check(U*); template static type_traits::no_type check(...); static const bool value = sizeof(check(0)) == sizeof(type_traits::yes_type); }; } // namespace detail template struct is_complete : boost::integral_constant::type>::value || ::boost::detail::is_complete_imp::value> {}; template struct is_complete : boost::is_complete {}; #else template struct is_complete : public boost::integral_constant {}; #undef BOOST_TT_HAS_WORKING_IS_COMPLETE #endif } // namespace boost #endif // BOOST_TT_IS_COMPLETE_HPP_INCLUDED