Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:01:40

0001 
0002 //  (C) Copyright John Maddock 2017.
0003 //  Use, modification and distribution are subject to the Boost Software License,
0004 //  Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0005 //  http://www.boost.org/LICENSE_1_0.txt).
0006 //
0007 //  See http://www.boost.org/libs/type_traits for most recent version including documentation.
0008  
0009 #ifndef BOOST_TT_IS_COMPLETE_HPP_INCLUDED
0010 #define BOOST_TT_IS_COMPLETE_HPP_INCLUDED
0011 
0012 #include <boost/type_traits/declval.hpp>
0013 #include <boost/type_traits/integral_constant.hpp>
0014 #include <boost/type_traits/remove_reference.hpp>
0015 #include <boost/type_traits/is_function.hpp>
0016 #include <boost/type_traits/detail/yes_no_type.hpp>
0017 #include <boost/config/workaround.hpp>
0018 #include <cstddef>
0019 
0020 /*
0021  * CAUTION:
0022  * ~~~~~~~~
0023  *
0024  * THIS TRAIT EXISTS SOLELY TO GENERATE HARD ERRORS WHEN A ANOTHER TRAIT
0025  * WHICH REQUIRES COMPLETE TYPES AS ARGUMENTS IS PASSED AN INCOMPLETE TYPE
0026  *
0027  * DO NOT MAKE GENERAL USE OF THIS TRAIT, AS THE COMPLETENESS OF A TYPE
0028  * VARIES ACROSS TRANSLATION UNITS AS WELL AS WITHIN A SINGLE UNIT.
0029  *
0030 */
0031 
0032 namespace boost {
0033 
0034 
0035 //
0036 // We will undef this if the trait isn't fully functional:
0037 //
0038 #define BOOST_TT_HAS_WORKING_IS_COMPLETE
0039 
0040 #if !defined(BOOST_NO_SFINAE_EXPR) && !BOOST_WORKAROUND(BOOST_MSVC, <= 1900) && !BOOST_WORKAROUND(BOOST_GCC_VERSION, < 40600)
0041 
0042    namespace detail{
0043 
0044       template <std::size_t N>
0045       struct ok_tag { double d; char c[N]; };
0046 
0047       template <class T>
0048       ok_tag<sizeof(T)> check_is_complete(int);
0049       template <class T>
0050       char check_is_complete(...);
0051    }
0052 
0053    template <class T> struct is_complete
0054       : public integral_constant<bool, ::boost::is_function<typename boost::remove_reference<T>::type>::value || (sizeof(boost::detail::check_is_complete<T>(0)) != sizeof(char))> {};
0055 
0056 #elif !defined(BOOST_NO_SFINAE) && !defined(BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS) && !BOOST_WORKAROUND(BOOST_GCC_VERSION, < 40500)
0057 
0058    namespace detail
0059    {
0060 
0061       template <class T>
0062       struct is_complete_imp
0063       {
0064          template <class U, class = decltype(sizeof(boost::declval< U >())) >
0065          static type_traits::yes_type check(U*);
0066 
0067          template <class U>
0068          static type_traits::no_type check(...);
0069 
0070          static const bool value = sizeof(check<T>(0)) == sizeof(type_traits::yes_type);
0071       };
0072 
0073 } // namespace detail
0074 
0075 
0076    template <class T>
0077    struct is_complete : boost::integral_constant<bool, ::boost::is_function<typename boost::remove_reference<T>::type>::value || ::boost::detail::is_complete_imp<T>::value>
0078    {};
0079    template <class T>
0080    struct is_complete<T&> : boost::is_complete<T> {};
0081    
0082 #else
0083 
0084       template <class T> struct is_complete
0085          : public boost::integral_constant<bool, true> {};
0086 
0087 #undef BOOST_TT_HAS_WORKING_IS_COMPLETE
0088 
0089 #endif
0090 
0091 } // namespace boost
0092 
0093 #endif // BOOST_TT_IS_COMPLETE_HPP_INCLUDED