File indexing completed on 2025-01-18 09:53:11
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef BOOST_TT_IS_DESTRUCTIBLE_HPP_INCLUDED
0010 #define BOOST_TT_IS_DESTRUCTIBLE_HPP_INCLUDED
0011
0012 #include <cstddef> // size_t
0013 #include <boost/type_traits/integral_constant.hpp>
0014 #include <boost/detail/workaround.hpp>
0015 #include <boost/type_traits/is_complete.hpp>
0016 #include <boost/static_assert.hpp>
0017
0018 #if !defined(BOOST_NO_CXX11_DECLTYPE) && !BOOST_WORKAROUND(BOOST_MSVC, < 1800)
0019
0020 #include <boost/type_traits/detail/yes_no_type.hpp>
0021 #include <boost/type_traits/declval.hpp>
0022
0023 namespace boost{
0024
0025 namespace detail{
0026
0027 struct is_destructible_imp
0028 {
0029 template<typename T, typename = decltype(boost::declval<T&>().~T())>
0030 static boost::type_traits::yes_type test(int);
0031 template<typename>
0032 static boost::type_traits::no_type test(...);
0033 };
0034
0035 }
0036
0037 template <class T> struct is_destructible : public integral_constant<bool, sizeof(boost::detail::is_destructible_imp::test<T>(0)) == sizeof(boost::type_traits::yes_type)>
0038 {
0039 BOOST_STATIC_ASSERT_MSG(boost::is_complete<T>::value, "Arguments to is_destructible must be complete types");
0040 };
0041
0042 #else
0043
0044 #include <boost/type_traits/is_pod.hpp>
0045 #include <boost/type_traits/is_class.hpp>
0046
0047 namespace boost{
0048
0049
0050 template <class T> struct is_destructible : public integral_constant<bool, is_pod<T>::value || is_class<T>::value>
0051 {
0052 BOOST_STATIC_ASSERT_MSG(boost::is_complete<T>::value, "Arguments to is_destructible must be complete types");
0053 };
0054 #endif
0055
0056 template <> struct is_destructible<void> : public false_type{};
0057 template <> struct is_destructible<void const> : public false_type{};
0058 template <> struct is_destructible<void volatile> : public false_type{};
0059 template <> struct is_destructible<void const volatile> : public false_type{};
0060 template <class T> struct is_destructible<T&> : public is_destructible<T>{};
0061 #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
0062 template <class T> struct is_destructible<T&&> : public is_destructible<T>{};
0063 #endif
0064 template <class T, std::size_t N> struct is_destructible<T[N]> : public is_destructible<T>{};
0065 template <class T> struct is_destructible<T[]> : public is_destructible<T>{};
0066
0067 }
0068
0069 #endif